ci: skip secret-dependent steps for PRs from forks - #92
Conversation
Fork PRs cannot access repository secrets or write-scoped tokens, so the coverage upload (COVERALLS_REPO_TOKEN) and the Docker build/push job (GH_TOKEN) always fail on them. Gate both on the head repo matching the base repo so fork PRs report green for those steps while unit tests still run.
There was a problem hiding this comment.
Pull request overview
Updates the PR CI workflow to avoid running secret-dependent steps/jobs when the PR originates from a fork, preventing predictable CI failures while keeping unit tests running for external contributors.
Changes:
- Gate the
Send coveragestep to run only for same-repo PRs (skips on forks). - Gate the
Build and push Docker imagejob to run only for same-repo PRs (and still skip Dependabot branches).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| run: go install github.com/mattn/goveralls@latest | ||
|
|
||
| - name: Send coverage | ||
| if: github.event.pull_request.head.repo.full_name == github.repository |
There was a problem hiding this comment.
Send coverage is now gated for fork PRs, but it will still run on Dependabot PRs (which also typically don’t receive repository secrets). That means COVERALLS_REPO_TOKEN will be empty and goveralls can still fail the job. Consider extending the if to also skip Dependabot PRs (e.g., the same !startsWith(github.head_ref, 'dependabot/') guard used by the build job), or gate on the token being non-empty.
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| if: github.event.pull_request.head.repo.full_name == github.repository && !startsWith(github.head_ref, 'dependabot/') && secrets.COVERALLS_REPO_TOKEN != '' |
Summary
Send coverage(needsCOVERALLS_REPO_TOKEN) and the entireBuild and push Docker imagejob (needsGH_TOKENto push to ghcr.io and commitChart.yaml) always fail on them.github.event.pull_request.head.repo.full_name == github.repositoryso fork PRs skip them cleanly while unit tests still run.Test plan
Send coverageand the build job should both run as before.Refs: #91
Generated with Claude Code