Repository navigation
Description
The problem
Requiring OAUTH tokens only when executing agent-task commands makes it difficult to automate.
For example:
Let's say I have a workflow that performs various activities on a repository or migrates that repository to another organization. Once that first step is completed, I want to assign copilot a task to go off and do something on the destination repository as outlined in a copilot-instructions.md file. I can't just call gh agent-task create -R <org/repo> -F copilot-instructions.md as this will return an error:
this command requires an OAuth token. Re-authenticate with: gh auth login
In most if not all previous steps I can perform other gh cli commands by having one of the following:
env:
GITHUB_TOKEN: ${{ github.token }}or
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}When specifically setting the GITHUB_TOKEN env to my personal access token, I still cannot run a create option for the agent-task command.
The workaround for this is to use a self-hosted runner and run:
`gh auth login`
`gh agent-task create ... `When the workflow reaches this step, the workflow pauses and waits for me to follow the device-code flow, then will proceed - not ideal for hands-off automation
Proposed solution
Do not restrict agent-task commands to be OAUTH required (the requireOAuthToken func will need to change)
OR
Potentially provide a copilot permissions section when generating a PAT/creating an App and allow us to automate creating a task for copilot.
Looking forward to a discussion on this 🚀
Activity
github-actions commentedon Oct 2, 2025
Thank you for your issue! We have categorized it as a feature request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
guidocelada commentedon Oct 3, 2025
+1
BagToad commentedon Oct 6, 2025
Thank you for the great issue @guidocelada ✨
I think this is blocked currently on the API requiring an OAuth token, but it's something that we're in active discussions about. I've labelled it as blocked for now.
To anyone that comes across this issue, please react to the original post as we use that count for enhancement discussions and prioritization ❤️ And we'd love to hear any other use-cases as well - those are very interesting and helpful to us.
Houndie commentedon Oct 9, 2025
Hi @BagToad, the job API definitely accepts PATs! It doesn't work (yet) with fine-grained tokens, but "classic" PATs should work just fine.As it turns out I'm very wrong here...there's staff exceptions I didn't know about! @BagToad is correct about the blockers
guidocelada commentedon Oct 10, 2025
@BagToad This is my use case:
I need to run it on a schedule every week or so.
guidocelada commentedon Oct 10, 2025
Can you also clarify which scopes are required for
gh agent-task createplease?Houndie commentedon Oct 10, 2025
@guidocelada I'm not super knowledgeable on actions, but what I think you're going to want to do is create a log-lived PAT (settings->Developer Settings->Personal Access Tokens->Generate a new token (classic). For classic tokens, you should be good to give it
repopermissions (if fine-grained tokens ever start working, you'd want "pull_request:write" and "actions:write", but those are both rolled up into the repo permissions on a classic token).This is where my knowledge gets a bit fuzzy, but I don't think you can ever use the
secret.GITHUB_TOKENthat comes with the action, since I don't think they're user scoped, and copilot always requires user tokens to use for billing purposes, so you'll need to inject a PAT into your action.cpatel-mck commentedon Nov 13, 2025
Hello, I'm running into the same issue when I try to assign a GitHub issue to Copilot agent using GitHub actions. I tried creating a PAT classic and FGT token under my profile (as I have a enterprise copilot license) but still when I try running
gh agent-task create "my-agent" -a "my-agent" -R "https://github.com/<my_gh_org/<my_gh_repo>"I getthis command requires an OAuth token. Re-authenticate with: gh auth loginI tried running
echo "${{ secrets.MY_TOKEN }}" | gh auth login --with-tokenjust beforegh-agent-task..command above, while the login is successful, I still getthis command requires an OAuth token. Re-authenticate with: gh auth loginerror.BagToad commentedon Nov 13, 2025
Hey @cpatel-mck, this is currently intended behavior you're seeing due to API requirements, but it's a known request that is being tracked internally.
ALUIZDEB commentedon Dec 10, 2025
Any updates here guys? Or workarrounds?
I think this is a important use case for a lot of people!
asklar commentedon Dec 10, 2025
for now I'm using the gh cli to create an issue and assign it to ghcp, but that's certainly less magical than have it show up in Sessions
ALUIZDEB commentedon Dec 11, 2025
I also do this here from my side. But I need to select a "Feature Branch", not default branch... =(
goataka commentedon Jan 25, 2026
+1
vinicius-oa commentedon Feb 8, 2026
any workaround?
alexef commentedon Feb 8, 2026
I managed to do it via the remote MCP 🙃 https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/create-a-pr#asking-copilot-to-create-a-pull-request-from-the-github-mcp-server which I auth using a PAT
cameronfleet-paxos commentedon Mar 16, 2026
+1, this is a blocker to even doing basic slackbots / building ontop of GH Agent HQ as an agent executor platform.
clement911 commentedon Apr 23, 2026
We also ran into that same issue.
Can gh agent-test create not be automated?
keithballdotnet commentedon Apr 23, 2026
Blocked. :(