Skip to content

Commit 7a6fd12

Browse files
greatgitsbympurnell1
authored andcommitted
ci: fix PR comment for fork PRs (#102)
* ci: fix PR comment for fork PRs using pull_request_target GITHUB_TOKEN for pull_request events from forks only gets read permissions, so the rootfs profile comment fails. Move the comment posting to a separate workflow using pull_request_target (which runs in the base repo context with write permissions), matching openpilot's pattern. * ci: rename pr-comment.yml to profile.yml
1 parent da110a9 commit 7a6fd12

2 files changed

Lines changed: 1 addition & 44 deletions

File tree

.github/workflows/build.yml

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -64,48 +64,6 @@ jobs:
6464
build/rootfs-profile.md
6565
if-no-files-found: error
6666

67-
- name: download master baseline
68-
if: github.event_name == 'pull_request'
69-
env:
70-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71-
run: |
72-
mkdir -p baseline
73-
RUN_ID=$(gh run list --workflow=build.yml --branch=master \
74-
--status=success --limit=1 --json databaseId --jq '.[0].databaseId')
75-
if [ -n "$RUN_ID" ]; then
76-
gh run download "$RUN_ID" --name rootfs-profile --dir baseline/ || true
77-
fi
78-
79-
- name: post PR comment
80-
if: github.event_name == 'pull_request'
81-
env:
82-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83-
run: |
84-
# Generate diff (gracefully handles missing baseline)
85-
DIFF_MD=$(./vamos profile diff baseline/rootfs-profile.json build/rootfs-profile.json 2>/dev/null || echo "No baseline available")
86-
PROFILE_MD=$(cat build/rootfs-profile.md)
87-
88-
# Assemble comment with hidden marker for find-and-update
89-
printf -v COMMENT_BODY '%s\n%s\n\n%s\n%s\n\n---\n\n%s' \
90-
'<!-- rootfs-profile-bot -->' \
91-
'## vamOS System Profile' \
92-
'### Changes vs master' \
93-
"$DIFF_MD" \
94-
"$PROFILE_MD"
95-
96-
# Find existing comment by marker
97-
COMMENT_ID=$(gh api \
98-
"repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" \
99-
--jq '.[] | select(.body | contains("<!-- rootfs-profile-bot -->")) | .id' \
100-
| head -1)
101-
102-
if [ -n "$COMMENT_ID" ]; then
103-
gh api "repos/${{ github.repository }}/issues/comments/$COMMENT_ID" \
104-
-X PATCH -f body="$COMMENT_BODY"
105-
else
106-
gh pr comment "${{ github.event.pull_request.number }}" --body "$COMMENT_BODY"
107-
fi
108-
10967
release:
11068
if: github.event_name == 'push'
11169
needs: [build-kernel, build-system]

.github/workflows/profile.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ jobs:
2020
- uses: actions/checkout@v4
2121

2222
- name: wait for build
23-
uses: lewagon/wait-on-check-action@v1.6.0
23+
uses: lewagon/wait-on-check-action@v1.3.4
2424
with:
2525
ref: ${{ env.SHA }}
2626
check-name: build-system
2727
repo-token: ${{ secrets.GITHUB_TOKEN }}
2828
allowed-conclusions: success
2929
wait-interval: 20
30-
checks-discovery-timeout: 300
3130

3231
- name: get build run ID
3332
id: get_run_id

0 commit comments

Comments
 (0)