-
Notifications
You must be signed in to change notification settings - Fork 445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: PR Preview Workflow via GitHub Pages #4848
Conversation
57f74e2
to
83e622c
Compare
Signed-off-by: Adarsh <[email protected]>
Signed-off-by: Adarsh <[email protected]>
Signed-off-by: Adarsh <[email protected]>
6a8769f
to
fc176c2
Compare
ref: ${{ github.event.pull_request.head.ref }} | ||
repository: ${{ github.event.pull_request.head.repo.full_name }} | ||
|
||
- name: Check PR Label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simpler. Take a look at other workflows: https://github.com/p4lang/p4c/blob/main/.github/workflows/ci-ubuntu-20-sanitizer-nightly.yml#L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially attempted to use the pull_request
trigger, but it’s restricted by security rules for commenting on PR from forks.
We need to use pull_request_target
for commenting because it has the required access to the base repository. However, it doesn’t provide an easy way to fetch labels directly. To handle this, I used actions/github-script
to retrieve labels through GitHub's REST API, which works for forked PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I see, this workflow is very complex it could be hard to maintain.
Let's merge it and see how it behaves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! The best way to test it is to merge and see how the PR workflow behaves going forward.
This PR improves the existing functionality of deploying the main branch to GitHub Pages, providing an additional layer of testing for Documentation PRs by enabling previewing pull requests via GitHub Pages.
Changes
documentation
tag will trigger a preview build that is deployed to a unique GitHub Pages URL. The preview is dynamically updated with the latest changes from the PR.Benefits
This update enhances Documentation PR review process & provides faster Iterations by offering a real-time preview of documentation changes on GitHub Pages. The preview automatically updates with each PR change, enabling immediate feedback and faster iterations. It also provides automatic notifications for build failures.
Usage
Once a PR tagged with
documentation
label, the workflow will trigger and deploy the preview to GitHub Pages.A comment will be posted on the PR with the link to the preview and deployment status (Passed/Failed).
Test and Review this workflow
Please review and test this new feature on the test documentation repo and check the following sample PR for reference .
Additional Context
This update addresses a concern raised in a PR review comment about testing Docs PRs locally before merging. For more details on how to test locally, see my comment.
While local testing is possible, it can be redundant for maintainers. Tracking PR changes and syncing with remote updates can be difficult, leading to version mismatches and inconsistencies.