From c8dcaf755e003ae08833ea311bc210284949beeb Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Thu, 19 Nov 2026 09:13:24 +0100 Subject: [PATCH 1/2] ci(risk): Move the PR risk check to the classifiers action The risk classifier moved from getsentry/sdk-pr-risk-action to the internal getsentry/classifiers repository. A public repository cannot call an action in an internal one directly, so the workflow now gets a short-lived, read-only app token, checks the classifiers out at a pinned commit and runs the action from that checkout. Classification is unchanged. Two things are new: the action skips runs started by a title or description edit when the PR already has a risk label, and it keeps one summary comment on the PR with the label and its reasons. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/pr-classifiers.yml | 71 ++++++++++++++++++++++++++++ .github/workflows/pr-risk-jev.yml | 46 ------------------ 2 files changed, 71 insertions(+), 46 deletions(-) create mode 100644 .github/workflows/pr-classifiers.yml delete mode 100644 .github/workflows/pr-risk-jev.yml diff --git a/.github/workflows/pr-classifiers.yml b/.github/workflows/pr-classifiers.yml new file mode 100644 index 0000000000..545d9c6f9f --- /dev/null +++ b/.github/workflows/pr-classifiers.yml @@ -0,0 +1,71 @@ +name: PR classifiers + +on: + pull_request_target: + # Keep `edited`: it is the only event fired when the base branch changes. The action + # itself skips title and description edits. + types: [opened, synchronize, reopened, ready_for_review, edited, converted_to_draft] + +permissions: {} + +concurrency: + # Two groups per pull request. Runs started by a title or description edit ("text") must + # never share a group with the runs that score a revision ("score"): GitHub keeps only one + # pending run per group, so a pending text edit would replace the pending run for a new + # commit, and the action would then skip the edit because the previous commit's label is + # still on the PR. Do not simplify this expression. + group: pr-classifiers-${{ github.event.pull_request.number }}-${{ github.event.action == 'edited' && !github.event.changes.base && 'text' || 'score' }} + # Every started run must reach its label clear; an overtaken run ends as `pr_changed`. + cancel-in-progress: false + +jobs: + classify: + name: PR classifiers + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: read + pull-requests: write # this job only; needed to publish the risk label and the summary comment + steps: + # This job must never check out or run code from the pull request. The only checkout + # is the classifiers repository, at a pinned commit. + - name: Get a token for the classifiers repository + id: app + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + app-id: ${{ vars.CLASSIFIERS_APP_ID }} + private-key: ${{ secrets.CLASSIFIERS_APP_KEY }} + repositories: classifiers + permission-contents: read + + - name: Fetch the classifiers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: getsentry/classifiers + ref: e9cc499bbf218d6166d201a895f7bed206a92c60 + token: ${{ steps.app.outputs.token }} + path: .classifiers + persist-credentials: false + + - name: Classify the pull request + id: classify + uses: ./.classifiers/actions/pr + env: + # On this step only, never at job or workflow level. + AI_GATEWAY_API_KEY: ${{ secrets.AI_GATEWAY_API_KEY }} + with: + repo: ${{ github.repository }} + pr-number: ${{ github.event.pull_request.number }} + expected-head-sha: ${{ github.event.pull_request.head.sha }} + result-path: pr-classifiers-result.json + publish-label: true + publish-comment: true + + - name: Upload the result + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 + with: + name: pr-classifiers-${{ github.event.pull_request.number }} + path: pr-classifiers-result.json + if-no-files-found: warn + retention-days: 30 diff --git a/.github/workflows/pr-risk-jev.yml b/.github/workflows/pr-risk-jev.yml deleted file mode 100644 index 011cdf891e..0000000000 --- a/.github/workflows/pr-risk-jev.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: PR Risk (Jev) - -on: - pull_request_target: - # Keep `edited`: it is the only event fired when the base branch changes. - types: [opened, synchronize, reopened, ready_for_review, edited, converted_to_draft] - -permissions: {} - -concurrency: - group: pr-risk-jev-${{ github.event.pull_request.number }} - # Every started run must reach its label clear; an overtaken run ends as `pr_changed`. - cancel-in-progress: false - -jobs: - risk: - name: PR risk (Jev) - runs-on: ubuntu-latest - timeout-minutes: 10 - permissions: - contents: read - pull-requests: write - steps: - # The Action reads PR Git objects without checking out or executing PR code. It clears the - # PR's risk labels first and publishes the new one itself, using the shared SDK rubric and - # the sentry-java fact sheet in getsentry/sdk-pr-risk-action. - - name: Classify PR risk - id: risk - uses: getsentry/sdk-pr-risk-action@46f2c96d3085a7a1ccde115de9a10f941816e439 # main - env: - AI_GATEWAY_API_KEY: ${{ secrets.AI_GATEWAY_API_KEY }} - with: - repo: ${{ github.repository }} - pr-number: ${{ github.event.pull_request.number }} - expected-head-sha: ${{ github.event.pull_request.head.sha }} - result-path: risk-pr-result.json - publish-label: true - - - name: Upload risk result - if: always() - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 - with: - name: pr-risk-jev-${{ github.event.pull_request.number }} - path: risk-pr-result.json - if-no-files-found: warn - retention-days: 30 From ffb33cd0616ae58bcab0a6d7f57d7241b913589d Mon Sep 17 00:00:00 2001 From: Stephanie Anderson Date: Thu, 19 Nov 2026 09:15:05 +0100 Subject: [PATCH 2/2] ci(risk): Identify the classifiers app by its client ID The token action deprecates app-id in favour of client-id. Co-Authored-By: Claude Fable 5.2 --- .github/workflows/pr-classifiers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-classifiers.yml b/.github/workflows/pr-classifiers.yml index 545d9c6f9f..4b03d38e9e 100644 --- a/.github/workflows/pr-classifiers.yml +++ b/.github/workflows/pr-classifiers.yml @@ -33,7 +33,7 @@ jobs: id: app uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 with: - app-id: ${{ vars.CLASSIFIERS_APP_ID }} + client-id: ${{ vars.CLASSIFIERS_APP_CLIENT_ID }} private-key: ${{ secrets.CLASSIFIERS_APP_KEY }} repositories: classifiers permission-contents: read