Skip to content

Declare explicit GITHUB_TOKEN permissions in workflows - #135

Merged
yawkat merged 3 commits into
mainfrom
fix/issue-117
Sep 25, 2026
Merged

yawkat merged 3 commits into
mainfrom
fix/issue-117

Conversation

@yawkat

@yawkat yawkat commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Fixes #117.

No workflow declared permissions:, and the repository default for GITHUB_TOKEN is currently read/write. This PR adds workflow-level blocks:

  • test.yml and build-all-and-publish.yml: contents: read.
  • docs.yml: contents: read and pull-requests: write. The write scope is used by gh-get-current-pr and actions-comment-pull-request to post the preview link.

Every job and action was checked. Checkout, setup-java/setup-uv, the artifact and cache actions (these use the runtime token), wrangler (Cloudflare secrets) and the Maven Central deploy (its own secrets) need nothing beyond this.

Manual follow-ups (repo settings):

  • Settings → Actions → General → Workflow permissions: switch the default to Read repository contents and packages permissions.
  • Optionally untick Allow GitHub Actions to create and approve pull requests.
  • Optional: move the GPG/Central and Cloudflare secrets into environments.

🤖 Generated with Claude Code

Restrict the token to read-only repository contents. The docs workflow
additionally needs pull-requests: write to comment the preview URL.

Fixes #117

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yawkat

yawkat commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

i think another pr changed the preview behavior

@yawkat yawkat added this to the 1.11.4 milestone Sep 25, 2026
@yawkat

yawkat commented Sep 25, 2026

Copy link
Copy Markdown
Owner Author

Right, #137 changed it: the PR-comment steps now only run on a manual dispatch from a non-main branch (on main that's a production rebuild, so no comment is posted). They still exist, so pull-requests: write is still needed. I updated the comment in docs.yml to say exactly when it's used, and merged main.

@yawkat
yawkat enabled auto-merge (squash) September 25, 2026 17:05
@yawkat
yawkat merged commit 4c685a9 into main Sep 25, 2026
3 checks passed
@yawkat
yawkat deleted the fix/issue-117 branch September 25, 2026 17:16
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.

Add explicit permissions to GitHub workflows

1 participant