fix(ci): add pull_request trigger to docs-site workflow so required c…#701
fix(ci): add pull_request trigger to docs-site workflow so required c…#701Demiserular wants to merge 1 commit into
Conversation
sonukapoor
left a comment
There was a problem hiding this comment.
Hey @Demiserular, thanks for digging into this - the root cause is correct and the overall approach is solid. A few things to address before we merge.
The branch is behind main. Could you rebase against the latest main before we finalize? git fetch origin && git rebase origin/main then force-push.
report-build-status will always pass, even when the build fails.
The job runs echo "..." unconditionally and always exits 0. That means the required status check shows green on a PR even if the Docusaurus build blew up - which defeats the purpose of having a required check.
Fix:
- name: Report build status
run: |
echo "Build completed with status: ${{ needs.build.result }}"
if [ "${{ needs.build.result }}" != "success" ]; then
exit 1
fiThe pull_request trigger has no branches filter.
The push trigger is scoped to main, but pull_request has no branches filter, so it runs on PRs targeting any branch. Worth adding branches: [main] to match:
pull_request:
branches:
- main
paths:
- "website/**"
- ".github/workflows/docs-site.yml"The guards look correct. The if: github.event_name == 'push' on artifact upload and if: github.event_name == 'push' && github.ref == 'refs/heads/main' on deploy are both right - nothing deploys on PRs.
Once those two things are addressed, this is ready.
Summary
Add pull_request trigger to docs-site.yml workflow so required status checks run on PRs touching website/** files.
Why this change
The
docs-site.ymlworkflow only triggered on push to main, which meant the two required status checks ("Build Docusaurus site" and "report-build-status") never ran on PRs. This caused all PRs touching website/** files to be blocked by checks that could never pass, requiring --admin to bypass.What changed
if: github.event_name == 'push'(no artifact needed on PRs)if: github.event_name == 'push' && github.ref == 'refs/heads/main'(only deploy on real merges)Validation
The workflow changes follow GitHub Actions best practices for PR validation vs production deployment. The build job runs on both PRs and pushes, while artifact upload and deployment are restricted to push events only.
User-facing impact
Does this change:
Notes
This is a CI/CD fix only. No changes to the actual documentation content or CLI behavior.
Fixes #697