Skip to content

Use COPILOT_GITHUB_TOKEN for Copilot task data collection in centralization optimizer#39437

Merged
mnkiefer merged 1 commit into
mainfrom
copilot/investigate-action-failure
Jun 15, 2026
Merged

Use COPILOT_GITHUB_TOKEN for Copilot task data collection in centralization optimizer#39437
mnkiefer merged 1 commit into
mainfrom
copilot/investigate-action-failure

Conversation

Copilot AI commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

The Copilot Centralization Optimizer workflow failed during task collection because it authenticated the Copilot Agents API with github.token, which is not accepted by that endpoint. This change switches that step to a dedicated Copilot user token secret.

  • Problem addressed

    • Collect agent task data called gh api /agents/repos/.../tasks with GH_TOKEN: ${{ github.token }}, causing 401s for endpoints that require a Copilot-eligible user token.
  • Workflow auth update

    • In copilot-centralization-optimizer.md, updated the step environment to use:
      • GH_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
    • Recompiled workflow output to propagate the same change into copilot-centralization-optimizer.lock.yml.
  • Scope

    • No behavioral changes outside the task-collection authentication path.
    • This PR is limited to the centralization optimizer workflow source + generated lock file.
# before
env:
  GH_TOKEN: ${{ github.token }}

# after
env:
  GH_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
@mnkiefer mnkiefer marked this pull request as ready for review June 15, 2026 19:13
Copilot AI review requested due to automatic review settings June 15, 2026 19:13

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 Copilot Centralization Optimizer workflow to authenticate the Copilot Agents API task-collection call with a Copilot-eligible user token (secrets.COPILOT_GITHUB_TOKEN) instead of github.token, resolving 401s during agent task data collection.

Changes:

  • Switched Collect agent task data to use GH_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} in the workflow source.
  • Recompiled the workflow so the generated .lock.yml uses the same token and includes COPILOT_GITHUB_TOKEN in the manifest + log-redaction secret list.
Show a summary per file
File Description
.github/workflows/copilot-centralization-optimizer.md Updates the gh api /agents/... task-collection step to authenticate via secrets.COPILOT_GITHUB_TOKEN.
.github/workflows/copilot-centralization-optimizer.lock.yml Propagates the auth change into the compiled workflow, and adds COPILOT_GITHUB_TOKEN to declared/redacted secrets.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@mnkiefer mnkiefer merged commit 9ae0699 into main Jun 15, 2026
1 check passed
@mnkiefer mnkiefer deleted the copilot/investigate-action-failure branch June 15, 2026 19:19
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.

3 participants