Skip to content

Commit 36c70ba

Browse files
iavclaude
authored andcommitted
ci(docs-preview): skip publish/comment steps on fork PRs
The docs-preview workflow runs on `pull_request`, where a fork's GITHUB_TOKEN is read-only. The "Comment on PR with preview link" step then fails with "Resource not accessible by integration", turning the check red on every external contributor's PR even though the MkDocs build succeeded. Guard the two write-requiring steps (www publish, PR comment) with `if: github.event.pull_request.head.repo.full_name == github.repository`. Fork PRs still run the build that validates the docs but skip the steps needing write access, so the check stays green; internal branches publish the preview as before. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f3c42cb commit 36c70ba

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

.github/workflows/pdf-at-pr.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ jobs:
5050
working-directory: documentation
5151
run: mkdocs build --clean
5252

53+
# Publishing the preview and commenting need a writable GITHUB_TOKEN,
54+
# which pull_request from a fork does not get (token is read-only there).
55+
# Skip these steps for fork PRs so the check stays green after the build
56+
# step has already validated the docs; internal branches still publish.
5357
- name: Publish to `www` branch
58+
if: github.event.pull_request.head.repo.full_name == github.repository
5459
working-directory: www
5560
run: |
5661
mkdir -p "${{ github.event.number }}"
@@ -62,6 +67,7 @@ jobs:
6267
git push origin www || true
6368
6469
- name: Comment on PR with preview link
70+
if: github.event.pull_request.head.repo.full_name == github.repository
6571
uses: devindford/Append_PR_Comment@v1.1.3
6672
with:
6773
repo-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)