Skip to content

Fix codeowner-update auth: add github-token for PR creation#871

Merged
aaronpowell merged 1 commit intostagedfrom
fix/codeowner-update-auth
Mar 4, 2026
Merged

Fix codeowner-update auth: add github-token for PR creation#871
aaronpowell merged 1 commit intostagedfrom
fix/codeowner-update-auth

Conversation

@aaronpowell
Copy link
Contributor

The create-pull-request safe output was failing with:

remote: Invalid username or token. Password authentication is not supported for Git operations.

The default GITHUB_TOKEN cannot push branches in this org. This adds github-token: ${{ secrets.GH_AW_GITHUB_TOKEN }} to the create-pull-request safe output so the compiled lock file uses a token with write permissions.

Note: The GH_AW_GITHUB_TOKEN secret must be configured in the repo with contents: write and pull-requests: write permissions.

The default GITHUB_TOKEN cannot push branches in this org.
Add explicit github-token using GH_AW_GITHUB_TOKEN secret
to the create-pull-request safe output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 4, 2026 00:07
Copy link
Contributor

Copilot AI left a comment

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 Codeowner Update agentic workflow to use an explicit write-capable token when creating pull requests, addressing Git auth failures caused by this org’s default GITHUB_TOKEN being unable to push branches.

Changes:

  • Add github-token: ${{ secrets.GH_AW_GITHUB_TOKEN }} to the create-pull-request safe output configuration.
  • Regenerate the compiled workflow so the safe-outputs PR-creation path uses GH_AW_GITHUB_TOKEN for checkout and git remote authentication.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
.github/workflows/codeowner-update.md Configures the create-pull-request safe output to use GH_AW_GITHUB_TOKEN.
.github/workflows/codeowner-update.lock.yml Compiled workflow updates checkout + git auth to use GH_AW_GITHUB_TOKEN during PR creation.

You can also share your feedback on Copilot code review. Take the survey.

base-branch: staged
title-prefix: "[codeowner] "
draft: false
github-token: ${{ secrets.GH_AW_GITHUB_TOKEN }}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

github-token is now required for PR creation, but the workflow doesn’t appear to validate that secrets.GH_AW_GITHUB_TOKEN is set/non-empty. If it’s missing, failures later in the run can be hard to diagnose. Consider adding an explicit validation step (similar to the existing COPILOT_GITHUB_TOKEN validation) to fail fast with a clear message.

Copilot uses AI. Check for mistakes.
Comment on lines 1132 to 1134
with:
token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
token: ${{ secrets.GH_AW_GITHUB_TOKEN }}
persist-credentials: false
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

actions/checkout now uses token: ${{ secrets.GH_AW_GITHUB_TOKEN }} without a fallback. If the secret is missing/empty in a new environment, checkout/push will fail with an auth error. A small fail-fast validation for GH_AW_GITHUB_TOKEN earlier in the workflow would make this easier to troubleshoot.

Copilot uses AI. Check for mistakes.
@aaronpowell aaronpowell merged commit 75b4531 into staged Mar 4, 2026
6 checks passed
@aaronpowell aaronpowell deleted the fix/codeowner-update-auth branch March 4, 2026 01:31
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