Skip to content

fix: add explicit GITHUB_TOKEN permissions to workflows#74

Merged
chrisjwalk merged 2 commits into
mainfrom
fix/workflow-permissions-73
Mar 16, 2026
Merged

fix: add explicit GITHUB_TOKEN permissions to workflows#74
chrisjwalk merged 2 commits into
mainfrom
fix/workflow-permissions-73

Conversation

@chrisjwalk-bot
Copy link
Copy Markdown
Collaborator

Closes #73

Locks down GITHUB_TOKEN to the minimum required permissions per job (CodeQL alerts #1, #2, #3).

Workflow Job Permissions
ci.yml ci contents: read, pull-requests: write
preview.yml deploy_preview contents: read, pull-requests: write
preview.yml close_preview pull-requests: write
deploy.yml deploy already had explicit permissions ✅

pull-requests: write is needed for the sticky coverage comment in CI and for the Azure SWA action posting the preview URL on PRs.

Lock down GITHUB_TOKEN to minimum required permissions per job,
following principle of least privilege (CodeQL alerts #1, #2, #3).

ci.yml:       contents: read, pull-requests: write
preview.yml:  deploy_preview: contents: read + pull-requests: write
              close_preview:  pull-requests: write only (no checkout)

deploy.yml already had explicit permissions and is unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-74.eastus2.2.azurestaticapps.net

When a PR only changes non-code files (e.g. workflow YAML), nx affected
runs no tests so no coverage XML is produced and code-coverage-results.md
is never created. The sticky-pull-request-comment step then fails with
'Either message or path input is required'.

- Add continue-on-error to CodeCoverageSummary (graceful no-op)
- Add a Check step that sets coverage.outputs.exists
- Gate annotate, summary, and comment steps on that output

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Azure Static Web Apps: Your stage site is ready! Visit it here: https://green-water-08792290f-74.eastus2.2.azurestaticapps.net

@chrisjwalk chrisjwalk merged commit db967e9 into main Mar 16, 2026
7 checks passed
@chrisjwalk chrisjwalk deleted the fix/workflow-permissions-73 branch March 16, 2026 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: add explicit permissions to GitHub Actions workflows

2 participants