An autonomous agent is designed to implement a minor code fix, push changes to a new branch, and open a pull request — all without human initiation of those individual steps. Which combination of GitHub token permissions is the minimum required for this agent to complete its task?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Creating a branch and pushing code is a Contents write operation; opening a PR is a Pull requests write operation — those two together are your minimum toolkit. Think of it like needing a key to the file cabinet (Contents write) and a key to the submission inbox (Pull requests write). You don't need admin rights or workflow rights just to push a branch and open a PR.
Full explanation below image
Full Explanation
When designing the minimum token scope for an autonomous agent that creates branches, pushes commits, and opens pull requests, you apply the principle of least privilege: grant only what is explicitly required for the task.
Option A is correct. Pushing to a new branch is a repository contents write operation — it requires the Contents: write permission. Creating a pull request is a pull request write operation — it requires Pull requests: write. Together, these two permissions are sufficient and nothing more is needed for this specific workflow. This is the minimum viable permission set.
Option B is wrong. Contents: read is insufficient for pushing commits or creating a new branch; the agent needs write access to contents to perform those operations. Adding Workflows: write is not required unless the agent is modifying GitHub Actions workflow files in .github/workflows/. Granting extra permissions like Workflows write violates least privilege and creates unnecessary risk.
Option C is wrong. Administration: write grants powerful permissions including repository settings, branch protection rule management, and team access — none of which are needed to push a branch and open a PR. Including Administration write in an agent's token is a significant security risk and should never be part of a minimum scope design.
Option D is wrong. Pull requests: read only allows the agent to read existing pull requests, not create them. The agent must have Pull requests: write to open a new PR. Checks: write would only be needed if the agent is reporting CI check results, which is outside the scope of this task.