Skip to content

Commit 9f88af6

Browse files
committed
fix(ci): tolerate missing PR comment permissions
1 parent 41265dc commit 9f88af6

5 files changed

Lines changed: 18 additions & 7 deletions

File tree

.github/workflows/runglass-receipt.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
permissions:
99
contents: read
1010
issues: write
11-
pull-requests: read
11+
pull-requests: write
1212

1313
env:
1414
CARGO_TERM_COLOR: always
@@ -40,6 +40,9 @@ jobs:
4040

4141
- name: Comment RunGlass receipt on PR
4242
if: always() && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && hashFiles('runglass-receipt/receipt.json') != ''
43-
run: runglass github comment --receipt runglass-receipt/receipt.json --auto
43+
run: |
44+
if ! runglass github comment --receipt runglass-receipt/receipt.json --auto; then
45+
echo "::warning::RunGlass could not post a PR comment. The receipt artifact was uploaded; check workflow token permissions."
46+
fi
4447
env:
4548
GITHUB_TOKEN: ${{ github.token }}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Made `cargo install runglass --locked` the primary README install path and documented local checkout installation separately.
66
- Added a Linux-first platform support matrix with explicit macOS and Windows observation limitations.
77
- Added a RunGlass dogfood GitHub Actions workflow that runs workspace tests through `runglass ci`, uploads the receipt artifact, and comments on pull requests when permissions allow.
8-
- Tightened GitHub Actions examples to avoid comment attempts on forked pull requests without write permission.
8+
- Tightened GitHub Actions examples to avoid comment attempts on forked pull requests without write permission and to keep receipt artifact workflows green when PR comment permissions are unavailable.
99
- Documented GitHub release binary archives and SHA-256 checksum artifacts for Linux x86_64 releases, and made the release artifact workflow install Rust explicitly before building.
1010
- Focused the README demo section around one canonical receipt while keeping secondary demo links available.
1111

docs/ci.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ The PR comment API does not attach files directly. The workflow uploads `runglas
6161

6262
RunGlass dogfoods this pattern in [`.github/workflows/runglass-receipt.yml`](../.github/workflows/runglass-receipt.yml). Pull requests run the workspace tests through `runglass ci`, upload the receipt directory, and update one RunGlass PR comment when the workflow has permission to write issue comments.
6363

64+
If GitHub returns `Resource not accessible by integration`, the receipt artifact is still the source of truth. The PR comment token did not receive comment-write permission, commonly because the workflow is running from a fork or repository Actions settings restrict write permissions.
65+
6466
## GitLab CI
6567

6668
Use the example at [`docs/examples/gitlab-runglass-receipt.yml`](examples/gitlab-runglass-receipt.yml).

docs/examples/github-actions-runglass-receipt.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
permissions:
88
contents: read
99
issues: write
10-
pull-requests: read
10+
pull-requests: write
1111

1212
jobs:
1313
receipt:
@@ -32,6 +32,9 @@ jobs:
3232

3333
- name: Comment RunGlass receipt on PR
3434
if: always() && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && hashFiles('runglass-receipt/receipt.json') != ''
35-
run: runglass github comment --receipt runglass-receipt/receipt.json --auto
35+
run: |
36+
if ! runglass github comment --receipt runglass-receipt/receipt.json --auto; then
37+
echo "::warning::RunGlass could not post a PR comment. The receipt artifact was uploaded; check workflow token permissions."
38+
fi
3639
env:
3740
GITHUB_TOKEN: ${{ github.token }}

examples/ci/github-actions.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
permissions:
88
contents: read
99
issues: write
10-
pull-requests: read
10+
pull-requests: write
1111

1212
jobs:
1313
receipt:
@@ -32,6 +32,9 @@ jobs:
3232

3333
- name: Comment RunGlass receipt on PR
3434
if: always() && github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork && hashFiles('runglass-receipt/receipt.json') != ''
35-
run: runglass github comment --receipt runglass-receipt/receipt.json --auto
35+
run: |
36+
if ! runglass github comment --receipt runglass-receipt/receipt.json --auto; then
37+
echo "::warning::RunGlass could not post a PR comment. The receipt artifact was uploaded; check workflow token permissions."
38+
fi
3639
env:
3740
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)