You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2026/10/28 20:11:50 UTC

(streampipes) 01/01: ci: Remove pull_request_target from CI workflows

This is an automated email from the ASF dual-hosted git repository.

dominikriemer pushed a commit to branch modify-github-actions-asf
in repository https://gitbox.apache.org/repos/asf/streampipes.git

commit 79d206f9ced64776ac08b054b4b1de7666ead32a
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Wed Oct 28 21:11:30 2026 +0100

    ci: Remove pull_request_target from CI workflows
---
 .github/workflows/go-client-e2e-test.yml           |  3 ++
 .github/workflows/go-client.yml                    |  3 ++
 .github/workflows/java-client-e2e-test.yml         |  3 ++
 .github/workflows/mvn-integration-test.yml         |  3 ++
 .../{pr-labeler.yml => pr-label-signal.yml}        | 24 +++------
 .github/workflows/pr-labeler.yml                   | 58 ++++++++++++++++++----
 .github/workflows/pr-validation.yml                |  5 ++
 7 files changed, 71 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/go-client-e2e-test.yml b/.github/workflows/go-client-e2e-test.yml
index 0b052497ec..83a99af7c5 100644
--- a/.github/workflows/go-client-e2e-test.yml
+++ b/.github/workflows/go-client-e2e-test.yml
@@ -18,6 +18,9 @@ name: run-e2e-tests
 on:
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   build-and-push-to-docker:
     runs-on: ubuntu-latest
diff --git a/.github/workflows/go-client.yml b/.github/workflows/go-client.yml
index cb65080470..d5ec6271d3 100644
--- a/.github/workflows/go-client.yml
+++ b/.github/workflows/go-client.yml
@@ -16,6 +16,9 @@
 name: go-client
 on:
   pull_request:
+permissions:
+  contents: read
+
 jobs:
   go-unit-tests:
     runs-on: ${{ matrix.os }}
diff --git a/.github/workflows/java-client-e2e-test.yml b/.github/workflows/java-client-e2e-test.yml
index 347d16139e..af393ecd06 100644
--- a/.github/workflows/java-client-e2e-test.yml
+++ b/.github/workflows/java-client-e2e-test.yml
@@ -18,6 +18,9 @@ name: run-java-client-e2e-tests
 on:
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   build-and-test:
     runs-on: ubuntu-latest
diff --git a/.github/workflows/mvn-integration-test.yml b/.github/workflows/mvn-integration-test.yml
index b62d8adfa7..c703813fd4 100644
--- a/.github/workflows/mvn-integration-test.yml
+++ b/.github/workflows/mvn-integration-test.yml
@@ -18,6 +18,9 @@ on:
   pull_request:
 
 
+permissions:
+  contents: read
+
 jobs:
   build_and_integration_test:
     runs-on: ubuntu-latest 
diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-label-signal.yml
similarity index 57%
copy from .github/workflows/pr-labeler.yml
copy to .github/workflows/pr-label-signal.yml
index e82089e97d..a52cf0199c 100644
--- a/.github/workflows/pr-labeler.yml
+++ b/.github/workflows/pr-label-signal.yml
@@ -13,26 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-name: "Pull Request Labeler"
-run-name: Pull request labeler for ${{ github.ref_name }}
+name: PR label signal
 
 on:
-  pull_request_target:
+  pull_request:
+    types: [opened, synchronize, reopened]
+
+permissions: {}
 
 jobs:
-  label-pr:
-    if: >-
-      github.event.pull_request.user.login != 'octobot' &&
-      github.event.pull_request.user.login != 'dependabot[bot]'
-    permissions:
-      # for actions/labeler to determine modified files
-      contents: read
-      # for actions/labeler to add labels to PRs
-      pull-requests: write
+  signal:
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/labeler@v7
-      with:
-        configuration-path: .github/pr-labeler-config.yml
-        # Remove labels when matching files are reverted
-        sync-labels: true
+      - run: echo "PR labeler runs when this workflow completes"
diff --git a/.github/workflows/pr-labeler.yml b/.github/workflows/pr-labeler.yml
index e82089e97d..1e49ea5e5e 100644
--- a/.github/workflows/pr-labeler.yml
+++ b/.github/workflows/pr-labeler.yml
@@ -14,25 +14,61 @@
 # limitations under the License.
 
 name: "Pull Request Labeler"
-run-name: Pull request labeler for ${{ github.ref_name }}
 
 on:
-  pull_request_target:
+  workflow_run:
+    workflows: ["PR label signal"]
+    types: [completed]
+
+permissions: {}
 
 jobs:
   label-pr:
     if: >-
-      github.event.pull_request.user.login != 'octobot' &&
-      github.event.pull_request.user.login != 'dependabot[bot]'
+      github.event.workflow_run.event == 'pull_request' &&
+      github.event.workflow_run.conclusion == 'success'
     permissions:
-      # for actions/labeler to determine modified files
       contents: read
-      # for actions/labeler to add labels to PRs
       pull-requests: write
     runs-on: ubuntu-latest
     steps:
-    - uses: actions/labeler@v7
-      with:
-        configuration-path: .github/pr-labeler-config.yml
-        # Remove labels when matching files are reverted
-        sync-labels: true
+      - name: Find the current pull request
+        id: pr
+        uses: actions/github-script@v8
+        env:
+          HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
+        with:
+          script: |
+            const sha = process.env.HEAD_SHA;
+            if (!/^[0-9a-f]{40}$/.test(sha)) {
+              throw new Error('Invalid workflow head SHA');
+            }
+            // workflow_run.pull_requests can be empty for fork contributions.
+            // Match the current head so superseded runs do not update labels.
+            const pulls = await github.paginate(github.rest.pulls.list, {
+              ...context.repo,
+              state: 'open',
+              per_page: 100,
+            });
+            const numbers = pulls
+              .filter(pr => pr.head.sha === sha &&
+                !['octobot', 'dependabot[bot]'].includes(pr.user.login))
+              .map(pr => pr.number);
+            core.setOutput('numbers', numbers.join('\n'));
+
+      - name: Checkout trusted label configuration
+        if: steps.pr.outputs.numbers != ''
+        uses: actions/checkout@v7.0.1
+        with:
+          ref: ${{ github.event.repository.default_branch }}
+          persist-credentials: false
+          sparse-checkout: .github/pr-labeler-config.yml
+          sparse-checkout-cone-mode: false
+
+      - uses: actions/labeler@v7
+        if: steps.pr.outputs.numbers != ''
+        with:
+          pr-number: ${{ steps.pr.outputs.numbers }}
+          configuration-path: .github/pr-labeler-config.yml
+          # Remove labels when matching files are reverted.
+          sync-labels: true
diff --git a/.github/workflows/pr-validation.yml b/.github/workflows/pr-validation.yml
index e27c5d049a..970e8a441b 100644
--- a/.github/workflows/pr-validation.yml
+++ b/.github/workflows/pr-validation.yml
@@ -18,6 +18,9 @@ name: PR validation
 on:
   pull_request:
 
+permissions:
+  contents: read
+
 jobs:
   run-rat-plugin:
     runs-on: ubuntu-latest
@@ -169,6 +172,8 @@ jobs:
     runs-on: ${{ matrix.os }}
     strategy:
       fail-fast: false
+      # Leave room for four independent jobs within ASF's recommended limit of 15.
+      max-parallel: 11
       matrix:
         python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
         os: [ubuntu-latest, macos-latest, windows-latest]