Fix labeler workflow for fork PRs using workflow_run pattern#10045
Fix labeler workflow for fork PRs using workflow_run pattern#10045
Conversation
Co-authored-by: ewels <465550+ewels@users.noreply.github.com>
Co-authored-by: ewels <465550+ewels@users.noreply.github.com>
Co-authored-by: ewels <465550+ewels@users.noreply.github.com>
|
@nf-core-bot fix linting |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | ||
| with: | ||
| github-token: ${{ github.token }} | ||
| script: | |
There was a problem hiding this comment.
if only there would be an action that does already all this ( CodelyTV/pr-size-labeler@4ec6770 👀)
There was a problem hiding this comment.
I assumed that it needs different inputs now? Yeah:
codelytv/pr-size-labeleris designed to run onpull_requestevents directly and reads the PR number fromgithub.event.pull_request.number.In a
workflow_runcontext, that event payload isn't available — the event is theworkflow_runobject instead, so the action wouldn't know which PR to label.
There was a problem hiding this comment.
Yeah I commented that on Slack... but assumed htere is a reason why it couldn't just use that.
|
Any idea what's wrong with |
|
nothing wrong with prek. just a prettier error without auto-fix. did it manually now |
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
There was a problem hiding this comment.
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| on: | |
| pull_request_target: |
This is actually the only thing needed to fix this, imo. Because the codelytv/pr-size-labeler doesn't need the code checked out, but only uses github API metadata, it shouldn't be a security risk
The labeler workflow fails on fork PRs because
pull_requestevents from forks receive read-onlyGITHUB_TOKEN, preventing label writes.Changes
Split into two workflows using
workflow_runpattern:Trigger workflow (
labeler.yml)pull_request(opened, reopened, synchronize)Apply workflow (
labeler_apply.yml)workflow_runafter trigger completesdawidd6/action-download-artifactactions/github-script:Implementation notes
Original prompt
This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.