Repository navigation
fix: authenticate cross-repo git via gh, guard clone failures (readme-refresh) #1067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1195947
5f70311
1666fc8
26b0080
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -205,9 +205,13 @@ process_repo() { | |
| local LINT_WARNINGS="" | ||
|
|
||
| log "Cloning $full_repo" | ||
| git clone --quiet \ | ||
| -c http.extraHeader="Authorization: Bearer ${GH_TOKEN}" \ | ||
| "https://github.com/${full_repo}.git" "$dir" | ||
| # Auth is handled by gh's git credential helper (configured in main via `gh auth setup-git`), | ||
| # which works for both PATs and App tokens. Guard the clone so a failure aborts this repo | ||
| # loudly instead of silently generating into an empty directory. | ||
| if ! git clone --quiet "https://github.com/${full_repo}.git" "$dir" || [ ! -d "$dir/.git" ]; then | ||
| warn "clone failed for $full_repo — skipping this repo" | ||
| return 0 | ||
| fi | ||
|
don-petry marked this conversation as resolved.
Resolved
|
||
| local default_branch | ||
| default_branch="$(git -C "$dir" symbolic-ref --short HEAD)" | ||
| # Rolling branch: always reset to default HEAD so the PR reflects "main + fresh READMEs". | ||
|
|
@@ -346,6 +350,13 @@ if ! command -v claude >/dev/null 2>&1; then | |
| exit 1 | ||
| fi | ||
|
|
||
| # Route git's github.com credentials through gh (uses GH_TOKEN). This authenticates the | ||
| # cross-repo clone/push for any token type — unlike an embedded x-access-token: or | ||
| # "Authorization: Bearer" header, which GitHub rejects for a classic/fine-grained PAT. | ||
| if ! gh auth setup-git --hostname github.com >/dev/null 2>&1; then | ||
| warn "gh auth setup-git failed — cross-repo git push may not authenticate" | ||
| fi | ||
|
don-petry marked this conversation as resolved.
Resolved
Comment on lines
+362
to
+364
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '--- scripts/aw-readme-refresh.sh (around lines 330-390) ---\n'
sed -n '330,390p' scripts/aw-readme-refresh.sh | cat -n
printf '\n--- search for setup-git usage and auth-related handling ---\n'
rg -n "setup-git|GIT_TERMINAL_PROMPT|auth setup|warn .*authenticate|cross-repo git" scripts/aw-readme-refresh.sh .github -SRepository: petry-projects/.github-private Length of output: 259 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '--- scripts/aw-readme-refresh.sh outline ---\n'
ast-grep outline scripts/aw-readme-refresh.sh --view expanded
printf '\n--- nearby logic for repo refresh / clone / push ---\n'
rg -n "clone|push|pull|fetch|gh auth setup-git|GIT_TERMINAL_PROMPT|token|GITHUB_TOKEN|gh repo" scripts/aw-readme-refresh.sh -n -SRepository: petry-projects/.github-private Length of output: 259 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# Show the relevant section and any surrounding auth/setup logic.
sed -n '340,380p' scripts/aw-readme-refresh.sh | cat -n
printf '\n'
rg -n "setup-git|GIT_TERMINAL_PROMPT|clone|push|warn " scripts/aw-readme-refresh.sh -SRepository: petry-projects/.github-private Length of output: 3189 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
sed -n '190,320p' scripts/aw-readme-refresh.sh | cat -nRepository: petry-projects/.github-private Length of output: 6615 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n "gh auth setup-git|credential helper|GIT_TERMINAL_PROMPT|clone failed|push --force-with-lease" scripts/aw-readme-refresh.sh -n -SRepository: petry-projects/.github-private Length of output: 679 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
# Inspect the repo-processing path and auth-related comments around clone/push.
sed -n '200,315p' scripts/aw-readme-refresh.sh | cat -nRepository: petry-projects/.github-private Length of output: 5795 Fail fast if 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
|
|
||
| facts_file="$(gather_facts)" | ||
| EMPTY_DESC_REPOS="$(cat "$WORK_DIR/empty_desc.txt" 2>/dev/null || echo "")" | ||
| log "Facts bundle assembled ($(wc -l < "$facts_file") lines); empty-desc repos: ${EMPTY_DESC_REPOS:-none}" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.