From 4e21ee99c4d455195a2d46b9337317c8fb11eabc Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 09:21:52 +0000 Subject: [PATCH 1/2] ci: Add PR classifiers workflow Co-Authored-By: johdax <114897+dingsdax@users.noreply.github.com> --- .github/workflows/pr-classifiers.yml | 75 ++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/pr-classifiers.yml diff --git a/.github/workflows/pr-classifiers.yml b/.github/workflows/pr-classifiers.yml new file mode 100644 index 000000000..9045a2e59 --- /dev/null +++ b/.github/workflows/pr-classifiers.yml @@ -0,0 +1,75 @@ +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: + # The app's client ID, not its numeric App ID (`app-id` is deprecated in this action). + client-id: ${{ vars.CLASSIFIERS_APP_CLIENT_ID }} + private-key: ${{ secrets.CLASSIFIERS_APP_KEY }} + repositories: classifiers + # The token can read this one repository's contents and nothing else. + permission-contents: read + + - name: Fetch the classifiers + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: getsentry/classifiers + ref: 3f2158c236f47bfb7e918a7350399769a59569ec + 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 + # The fact sheet is read from .github/classifiers.toml at the pull request's base commit. + publish-label: true + # Set to true to keep one summary comment on the pull request with the label and its reasons. + publish-comment: true + + - name: Upload the result + if: always() + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: pr-classifiers-${{ github.event.pull_request.number }} + path: pr-classifiers-result.json + if-no-files-found: warn + retention-days: 30 From e01c091037d235a7c6afaf6d0ba1da4eadc2ca4d Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Wed, 25 Nov 2026 10:35:07 +0000 Subject: [PATCH 2/2] ci: Use the shared pr-classifiers action from github-workflows Co-Authored-By: johdax <114897+dingsdax@users.noreply.github.com> --- .github/workflows/pr-classifiers.yml | 52 ++++------------------------ 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/.github/workflows/pr-classifiers.yml b/.github/workflows/pr-classifiers.yml index 9045a2e59..fd6860d7b 100644 --- a/.github/workflows/pr-classifiers.yml +++ b/.github/workflows/pr-classifiers.yml @@ -2,8 +2,7 @@ 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. + # 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: {} @@ -27,49 +26,10 @@ jobs: 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 + # This job must never check out or run code from the pull request. + - uses: getsentry/github-workflows/pr-classifiers@edc87d6f133ac6204e22dee5123167a5eff3ed79 with: - # The app's client ID, not its numeric App ID (`app-id` is deprecated in this action). - client-id: ${{ vars.CLASSIFIERS_APP_CLIENT_ID }} - private-key: ${{ secrets.CLASSIFIERS_APP_KEY }} - repositories: classifiers - # The token can read this one repository's contents and nothing else. - permission-contents: read - - - name: Fetch the classifiers - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - repository: getsentry/classifiers - ref: 3f2158c236f47bfb7e918a7350399769a59569ec - 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 - # The fact sheet is read from .github/classifiers.toml at the pull request's base commit. - publish-label: true - # Set to true to keep one summary comment on the pull request with the label and its reasons. + app-client-id: ${{ vars.CLASSIFIERS_APP_CLIENT_ID }} + app-private-key: ${{ secrets.CLASSIFIERS_APP_KEY }} + ai-gateway-api-key: ${{ secrets.AI_GATEWAY_API_KEY }} publish-comment: true - - - name: Upload the result - if: always() - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 - with: - name: pr-classifiers-${{ github.event.pull_request.number }} - path: pr-classifiers-result.json - if-no-files-found: warn - retention-days: 30