Skip to content

Commit ee10f9c

Browse files
committed
Post conformance PR comment via workflow_run
Fork PRs receive a read-only GITHUB_TOKEN regardless of the top-level permissions block, so the inline `gh pr comment` step in the conformance workflow fails with "Resource not accessible by integration" whenever a contributor opens a PR from a fork. Move the comment step into a separate workflow triggered by workflow_run, which runs in the base repo context with pull-requests: write and only reads the uploaded summary artifact — never checks out PR code.
1 parent 9c8a6ea commit ee10f9c

2 files changed

Lines changed: 44 additions & 4 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Comment PR with Conformance Results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Kernel Conformance"]
6+
types:
7+
- completed
8+
9+
permissions:
10+
pull-requests: write
11+
actions: read
12+
13+
jobs:
14+
comment:
15+
name: Post conformance summary
16+
runs-on: ubuntu-latest
17+
if: github.event.workflow_run.event == 'pull_request'
18+
steps:
19+
- name: Download PR comment artifact
20+
uses: actions/download-artifact@v4
21+
with:
22+
name: pr-comment
23+
run-id: ${{ github.event.workflow_run.id }}
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Post comment
27+
env:
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
GH_REPO: ${{ github.repository }}
30+
run: |
31+
PR=$(cat pr_number.txt)
32+
gh pr comment "$PR" --body-file summary.md

.github/workflows/conformance.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,19 @@ jobs:
391391
done
392392
} | tee -a $GITHUB_STEP_SUMMARY > summary.md
393393
394-
- name: Comment on PR
394+
- name: Save PR number for comment workflow
395395
if: github.event_name == 'pull_request'
396-
env:
397-
GH_TOKEN: ${{ github.token }}
398-
run: gh pr comment ${{ github.event.pull_request.number }} --body-file summary.md
396+
run: echo "${{ github.event.pull_request.number }}" > pr_number.txt
397+
398+
- name: Upload PR comment payload
399+
if: github.event_name == 'pull_request'
400+
uses: actions/upload-artifact@v4
401+
with:
402+
name: pr-comment
403+
path: |
404+
summary.md
405+
pr_number.txt
406+
if-no-files-found: error
399407

400408
- name: Upload combined reports
401409
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)