Skip to content

ci(pr): Explicitly pass copilot token, add debug info for spec review workflow#15795

Merged
dmcilvaney merged 2 commits intomicrosoft:tomls/base/mainfrom
dmcilvaney:damcilva/spec_agent_git_debug
Feb 11, 2026
Merged

ci(pr): Explicitly pass copilot token, add debug info for spec review workflow#15795
dmcilvaney merged 2 commits intomicrosoft:tomls/base/mainfrom
dmcilvaney:damcilva/spec_agent_git_debug

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

Attempt at fix for auth issues, with additional debug info in case it doesn't work.

Copilot AI review requested due to automatic review settings February 11, 2026 17:33
-p "$retry_prompt"
else
copilot --agent "spec-review" \
GH_TOKEN="${COPILOT_TOKEN:-$GH_TOKEN}" copilot --agent "spec-review" \
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just making sure -- copilot consumes from GH_TOKEN?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Comment thread .github/workflows/scripts/spec_review.sh Outdated
Copy link
Copy Markdown
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 spec review CI workflow authentication flow by separating standard GitHub API auth from Copilot CLI auth, and adds additional git-clone diagnostics to help troubleshoot guideline-repo fetch failures.

Changes:

  • Pass GITHUB_TOKEN via GH_TOKEN and add COPILOT_TOKEN to the spec review workflow step env.
  • Override GH_TOKEN only for the copilot process so the Copilot CLI uses the dedicated Copilot credential.
  • Add clone debug capture (trace/verbose) and print it only on clone failure.

Reviewed changes

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

File Description
.github/workflows/spec-review.yml Adjusts env vars so GH operations use GITHUB_TOKEN while providing COPILOT_TOKEN for the Copilot CLI.
.github/workflows/scripts/spec_review.sh Adds clone failure diagnostics and overrides GH_TOKEN for the Copilot invocation to use COPILOT_TOKEN.

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

Comment on lines +111 to +112
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COPILOT_TOKEN: ${{ secrets.COPILOT_TOKEN }}
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

This step now sets GH_TOKEN to GITHUB_TOKEN, but earlier the workflow's "Test gh auth" step still uses GH_TOKEN: secrets.COPILOT_TOKEN. That means GH_TOKEN refers to different credentials in different steps, which makes troubleshooting harder. Consider standardizing GH_TOKEN to always be GITHUB_TOKEN and only passing the Copilot credential via COPILOT_TOKEN (and update/rename the auth test accordingly).

Copilot uses AI. Check for mistakes.
Comment on lines +419 to 420
GH_TOKEN="${COPILOT_TOKEN:-$GH_TOKEN}" copilot --agent "spec-review" \
--model "$MODEL" \
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

With set -u, GH_TOKEN="${COPILOT_TOKEN:-$GH_TOKEN}" will error with an unbound variable if both COPILOT_TOKEN and GH_TOKEN are unset (common in local runs). Use a nested default like ${COPILOT_TOKEN:-${GH_TOKEN:-}} and add an explicit error if the resulting token is empty, so failures are deterministic and readable.

Copilot uses AI. Check for mistakes.
Comment on lines +297 to +304
clone_log="$(mktemp)"
if ! GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone --depth 1 --single-branch "$GIT_SOURCE" "$dest" 2>"$clone_log"; then
echo "Error: Failed to clone $GIT_SOURCE" >&2
cat "$clone_log" >&2
rm -f "$clone_log"
exit 1
fi
rm -f "$clone_log"
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

clone_log is created outside temp_sources_dir and isn't covered by the existing EXIT trap, so it can be left behind if the script is interrupted between mktemp and rm -f. Consider creating it under $temp_sources_dir (or adding it to the trap) to ensure cleanup on signals/exits.

Copilot uses AI. Check for mistakes.
@dmcilvaney dmcilvaney merged commit 9ab81dc into microsoft:tomls/base/main Feb 11, 2026
6 of 7 checks passed
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