ci(pages): restrict deploy-pages workflow to push and workflow_dispatch; remove id-token from permissions#696
Open
AAdewunmi wants to merge 3 commits into
Open
ci(pages): restrict deploy-pages workflow to push and workflow_dispatch; remove id-token from permissions#696AAdewunmi wants to merge 3 commits into
AAdewunmi wants to merge 3 commits into
Conversation
…ch; remove id-token from permissions
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub Pages deployment workflow to reduce the risk of deployments from pull requests (especially forks) by limiting when the workflow can run and tightening the workflow’s permission surface.
Changes:
- Restrict the workflow trigger to
pushonmainand manualworkflow_dispatch. - Remove workflow-level
id-token: writepermission and keepcontents: read/pages: write. - Keep a single deploy job using the standard Pages actions (
configure-pages,upload-pages-artifact,deploy-pages).
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/deploy-pages.yml | Adds/updates the Pages deploy workflow to run on main pushes and manual dispatch with adjusted permissions. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Low
Comment on lines
+18
to
+22
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest |
Collaborator
|
@AAdewunmi thanks for splitting the PRs please comment above Please make changes and then request copilot review |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Author
|
Hi @leestott, thanks for the review. The workflow has been updated.
The PR is now ready for Copilot review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restrict the GitHub Pages deployment workflow so it only runs on pushes to
mainand manual dispatch, and removeid-token: writefrom workflow-level permissions to avoid failures and accidental deployments from pull requests (especially forks).Changes
pull_requesttrigger; addworkflow_dispatchfor manual runs.push: branches: [ main ].id-token: writefrom the workflowpermissions.contents: readandpages: write(required for deployment).Behaviour
mainor when manually triggered.Why
pages/id-tokenpermissions, causing the workflow to fail or produce confusing status checks.pull_requestrisks deploying unreviewed code or exposing sensitive tokens.Validation
fix-deploy-pagescontains only this workflow change.workflow_dispatchrun completes successfully onmain.Result
A minimal, reviewable change that prevents Pages deployment runs on PRs (especially forks), reduces CI failures and accidental deployments, and prepares the workflow for further hardening.
Notes