The Symptom
A GitHub Actions workflow that has pushed commits, tagged a release, or posted a comment on a pull request for months suddenly starts failing. The error is usually something like Resource not accessible by integration or a plain 403, and nothing in the workflow file changed. The most common cause isn't a bug in the workflow at all -- it's the default permissions granted to the automatic GITHUB_TOKEN that every workflow run gets, and those defaults are stricter than most people assume.
Why the Token Suddenly Can't Do What It Used To
Every GitHub Actions job is handed a short-lived GITHUB_TOKEN automatically, scoped to the repository the workflow runs in. Since February 2023, GitHub's default for that token on new repositories (and on any repository where an organization owner sets the account-wide default) is read-only permissions -- it can check out code and read repo data, but it cannot push commits, create releases, open or comment on pull requests, or write to packages unless a workflow explicitly asks for that access. Older repositories created before the change often kept the old broad read/write default, which is exactly why one repo's release workflow still works fine while a brand-new repo's copy of the same workflow fails with no explanation -- they inherited different defaults at creation time.
The Fix: Declare Permissions in the Workflow File
The reliable fix is to stop relying on whatever the repository or organization default happens to be, and declare the permissions a workflow actually needs directly in its YAML. A top-level permissions block scopes the whole workflow; a job-level one scopes just that job, which is the better practice when only one job in a multi-job workflow needs write access:
permissions:
contents: write
pull-requests: write
Common scopes to reach for: contents: write for pushing commits or creating tags/releases, pull-requests: write for commenting on or labeling PRs, issues: write for creating or updating issues, and packages: write for publishing to GitHub Packages. Setting only the scopes actually used is also the more secure choice -- it's the same principle as not running a workflow with broader access than the job needs.
The Fork Pull Request Wrinkle
This gets more confusing on workflows triggered by pull_request from a fork. For security reasons, GitHub additionally forces the GITHUB_TOKEN to read-only on that trigger when the PR comes from a fork, regardless of what the workflow file's permissions block says, and it withholds repository secrets from that run too. A workflow that needs to comment back on a fork's PR (to post a build status or preview link, for example) generally needs to split into two workflows: the untrusted build itself on pull_request, and a separate, trusted workflow on workflow_run that reads the first workflow's output artifact and does the actual commenting with full permissions. Reaching for pull_request_target instead can work but runs with the base branch's workflow file against the fork's code, which is its own security tradeoff worth understanding before using it as a shortcut.
Checking and Fixing an Organization's Default
Beyond individual workflow files, an organization owner can set the account-wide default for new repositories under organization Settings → Actions → General → Workflow permissions, choosing between read-only and read/write as the starting point for every new repo. Changing this doesn't retroactively fix existing workflows that already specify (or omit) permissions -- it only changes what new repositories inherit -- so it's a policy decision for new work, not a quick patch for a currently-broken workflow.
Actionable Checklist
- If a previously-working push, release, or PR-comment step starts failing with a 403, check the workflow's
permissionsblock before anything else -- the code likely didn't change, the token's effective access did. - Add only the specific scopes needed (
contents: write,pull-requests: write, etc.) rather than defaulting to broad write access. - For fork PR workflows that need to post results back, split into a
pull_requestbuild job and aworkflow_runcomment job instead of fighting the forced read-only token. - Treat the org-level default as a policy for future repos, not a fix for a workflow that's already declaring its own permissions.
Getting CI/CD automation set up correctly the first time -- and understanding exactly what access each step actually needs -- is one of the more common places teams lose hours to a silent platform default. If GitHub Actions is part of a broader automation setup, our GitHub CI/CD automation overview and repository workflows guide cover the surrounding setup in more depth, and the full GitHub application page has the rest of what the platform covers. For more implementation guides like this one, see the blog.
