Skip to content

Use a user-owned PAT to trigger Copilot's coding agent on Dependabot PRs - #2733

Merged
Akanksha Jain (jainakanksha-msft) merged 1 commit into
mainfrom
use-copilot-assign-token
Aug 13, 2026
Merged

Use a user-owned PAT to trigger Copilot's coding agent on Dependabot PRs#2733
Akanksha Jain (jainakanksha-msft) merged 1 commit into
mainfrom
use-copilot-assign-token

Conversation

@jainakanksha-msft

Copy link
Copy Markdown
Member

Why

copilot-dependabot-agent.yml posts an @copilot ... comment on new Dependabot PRs to hand them to GitHub Copilot's coding agent. We confirmed (via PR timeline copilot_work_started events) that comments authored by github-actions[bot] using the default GITHUB_TOKEN never actually trigger the coding agent — only comments from a real user account with write access do. This is enforced by an org-level, locked Copilot Cloud Agent policy ("Only allow automations to be triggered by users with write access").

This matches how other Azure-org repos (apiops-cli, fleet, agents-on-aks, azure-sdk-tools's gh-aw workflows) solve the same problem: a classic/fine-grained PAT from a real account with a Copilot seat, stored as a repo secret.

Change

Swap the token used for the gh pr comment step from secrets.GITHUB_TOKEN to secrets.COPILOT_ASSIGN_TOKEN (a classic PAT, public_repo scope only, since Azurite is public). The secret has already been added to this repo.

Test plan

  • Confirm the next Dependabot PR gets a @copilot comment authored by the PAT owner
  • Confirm a copilot_work_started timeline event appears shortly after

github-actions[bot]-authored @copilot comments never triggered Copilot's
coding agent (org policy requires a write-access user, not a bot/App
identity). Switch to a classic PAT with public_repo scope instead.
Copilot AI lite review requested due to automatic review settings August 13, 2026 14:25
@jainakanksha-msft
Akanksha Jain (jainakanksha-msft) merged commit d380de2 into main Aug 13, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Dependabot-to-Copilot handoff workflow so the @copilot assignment comment is authored using a user-owned token (PAT), aligning with org policies that prevent the Copilot coding agent from being triggered by github-actions[bot] comments.

Changes:

  • Switches gh pr comment authentication from the default GITHUB_TOKEN to COPILOT_ASSIGN_TOKEN in the Dependabot Copilot assignment workflow.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 33 to 38
- name: Ask Copilot to work the PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.COPILOT_ASSIGN_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ steps.pr.outputs.number }}
run: gh pr comment "$PR_NUMBER" --body-file .github/copilot-dependabot-instructions.md
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.

2 participants