Use GitHub Actions permissions to limit what a coding-agent workflow can do with its GITHUB_TOKEN; use concurrency to decide which matching runs may proceed and whether older work is canceled. These are separate controls: a narrow token does not prevent overlapping runs, and a concurrency group does not limit token access.
Set permissions around each job’s actual work
GitHub lets you configure GITHUB_TOKEN access with the permissions key at workflow or job level. Grant only what the work requires. If you specify permissions, unspecified permissions are set to none; check the required scopes for every action and operation in the job. An action can access the token through the github.token context even when you do not explicitly pass a token input, so omitting an explicit token input is not a substitute for restricting permissions.
As an Amazon Associate I earn from qualifying purchases.
For a job that checks out and reads source, contents: read is a reasonable starting point. Add a write permission only for the job that needs it. GitHub’s tutorial, for example, combines contents: read with issues: write for a job that creates an issue; that is an illustration, not a default agent configuration. See GitHub’s automatic token authentication guidance and the GITHUB_TOKEN tutorial.
Free tools Windows power users keep installed
One-click scans. No signup required.
Workflow-level and job-level permissions
Workflow-level permissions are convenient when every job needs the same access. Prefer job-level permissions when jobs have meaningfully different responsibilities—for example, a read-only test job and a separate job that publishes a result. This makes the trust boundary easier to inspect and limits the effects of a compromised step or action to the token access available to its job.
#1 Best Overall
Permissions alone do not make untrusted code safe. Keep privileged operations separate from jobs that execute untrusted pull-request code or arbitrary user-supplied content. Review the code and actions that run in a privileged job, and avoid giving a job broad write access merely because another job needs it. GitHub’s secure-use guidance discusses least privilege and the risks associated with access to repository write permissions and secrets.
When the job needs to write
Identify the exact operation before adding access. Creating an issue needs an appropriate issues permission; other operations, such as pushing a commit or creating a pull request, require their corresponding access and may need a different token mechanism depending on repository policy. If GITHUB_TOKEN cannot provide the required access, GitHub documents alternatives such as a GitHub App installation token or a personal access token. Choose credentials with the narrowest suitable scope and protect them as secrets; do not assume an agent needs write access simply because it is an agent.
Rank #2
Choose a concurrency group that matches the resource
A concurrency group allows only one matching job or workflow to run at a time. By default, a group can have one running and one pending run; when another run becomes pending, GitHub cancels the previously pending run. That means a concurrency setting can discard work even when cancel-in-progress is not enabled. Read GitHub’s concurrency documentation before relying on a group for work that must not be skipped.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Isolate runs by workflow and ref
For branch checks that should supersede only other runs of the same workflow on the same ref, GitHub gives this group-name pattern:
Rank #3
group: ${{ github.workflow }}-${{ github.ref }}
The workflow name and ref distinguish separate workflows and branches. This avoids unintentionally making unrelated branch checks compete for one group.
Serialize workflows against a shared resource
If several workflows must not use the same deployment target or other shared resource simultaneously, use a deliberately shared group name for that resource. Be aware that workflows with the same group can affect one another: their pending runs compete, and cancellation settings can stop in-progress work. Choose this only when that cross-workflow coordination is intentional.
Rank #4
Decide whether a newer run may cancel older work
Set cancel-in-progress: true when a newer run makes an older check obsolete—for example, repeated validation of successive commits on the same branch. Avoid it for release or deployment work that should finish, or where every run must execute. GitHub also supports conditional cancellation, so cancellation can be limited to the cases where superseding work is safe. If every run must be processed, use a queuing approach supported by the current concurrency syntax and verify its behavior; do not assume runs are guaranteed to execute in strict first-in, first-out order.
Example: a read-only agent check workflow
This is a starting pattern, not a universal or tested agent configuration. It runs checks on pull requests and pushes to main, gives the check job read-only contents access, isolates concurrency by workflow and ref, and cancels an older in-progress run in that group.
Best Value
name: Agent checks
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checks:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- run: ./run-agent-checks.sh
Before adopting it, verify the actions and versions, whether the agent needs to write, whether pull-request code is trusted in this workflow, and whether canceling a run is acceptable. Change the triggers, group, and cancellation behavior to match repository policy and the work being protected.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Account for GITHUB_TOKEN-triggered workflow behavior
GitHub creates a unique GITHUB_TOKEN for each job. It is a GitHub App installation access token limited to the repository that contains the workflow. GitHub-hosted runners have a maximum job duration of six hours; self-hosted runners have a maximum of five days. For self-hosted runs, the installation token can be refreshed only up to 24 hours. These are platform limits, not recommended job durations. Details are in GitHub’s token documentation.
Most events generated with GITHUB_TOKEN do not trigger another workflow run. This helps prevent accidental recursive automation, but it matters if an agent pushes a commit or updates a pull request and the design expects a downstream workflow to start. GitHub documents exceptions including workflow_dispatch and repository_dispatch, as well as approval behavior for certain pull-request events. Check the event and authentication design rather than assuming a token-authenticated push will trigger follow-up automation. See the documented behavior and exceptions.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesUse repository and organization protections where needed
YAML permissions and concurrency govern a workflow’s token access and run coordination. Administrators can also configure workflow execution protections to restrict which actors and events may run specified workflows. GitHub describes these controls at repository, organization, or enterprise levels, subject to the account’s available settings and plan. The documented how-to covers public repositories and private repositories on GitHub Team or Enterprise. Administrators can use policy insights to evaluate blocked or would-be-blocked runs. See GitHub’s workflow execution protections guide.
GitHub’s Actions policy overview announced that a default policy blocking pull_request_target in public repositories would be enforced on November 2, 2026. That is an announced future date relative to October 4, 2026; check the current policy documentation and repository settings for its status before relying on it. The overview is at GitHub’s secure-use policy reference.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




