Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 7 additions & 43 deletions .github/workflows/pr-classifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand All @@ -25,47 +24,12 @@ jobs:
timeout-minutes: 10
permissions:
contents: read
pull-requests: write # this job only; needed to publish the risk label and the summary comment
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@f418cff399f7aef4c2f0ad47e25ca7a6abbdd6fc # v3.4.0
# This job must never check out or run code from the pull request.
- uses: getsentry/github-workflows/pr-classifiers@edc87d6f133ac6204e22dee5123167a5eff3ed79

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we downgrading to 3.3.0 on purpose here? or should we use 3.4.0 (or whatever is now available) instead?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the downgrade isn't on purpose. This workflow no longer pins create-github-app-token itself. The token step now runs inside the shared action, and pr-classifiers/action.yml at getsentry/github-workflows@edc87d6 still pins it to v3.3.0. v3.4.0 is the latest release.

This PR can't fix that. The bump has to land in pr-classifiers/action.yml in getsentry/github-workflows, and then this pin can move to that commit. I'll leave this thread open so a maintainer can decide whether to wait for that bump or merge as is (v3.3.0 works the same for this job).

with:
client-id: ${{ vars.CLASSIFIERS_APP_CLIENT_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
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
with:
name: pr-classifiers-${{ github.event.pull_request.number }}
path: pr-classifiers-result.json
if-no-files-found: warn
retention-days: 30
Loading