Repository navigation
Skip unmatched checkout.fetch refs without blocking other fetches - #71622
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot update docs and specs |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved security and ref-matching defects affect authenticated fetch execution.
2 open issues
What changed in this PR
Updates gh-aw’s static and runtime checkout paths so unmatched checkout.fetch patterns can be skipped without blocking other requested refs.
Changes:
- Checks and fetches patterns independently using authenticated commands.
- Preserves fetch-depth settings and discards discovery stdout.
- Adds regression coverage and documents unmatched-pattern behavior.
| File | Description |
|---|---|
pkg/workflow/checkout_step_generator.go |
Generates per-pattern discovery and fetch commands. |
pkg/workflow/checkout_manager_test.go |
Tests generated commands and mixed matching/missing refs. |
docs/src/content/docs/reference/checkout.md |
Documents independent fetching and skipped patterns. |
actions/setup/js/checkout_dynamic.test.cjs |
Covers runtime skipping, fatal errors, credentials, and output handling. |
actions/setup/js/checkout_dynamic.cjs |
Applies independent discovery and fetching to runtime checkouts. |
Review effort: Max
| refspecs := make([]string, 0, len(entry.fetchRefs)) | ||
| for _, ref := range entry.fetchRefs { | ||
| refspecs = append(refspecs, fmt.Sprintf("'%s'", fetchRefToRefspec(ref))) | ||
| refspecs = append(refspecs, shellEscapeArg(fetchRefToRefspec(ref))) |
There was a problem hiding this comment.
| sb.WriteString(" for refspec in " + strings.Join(refspecs, " ") + "; do\n") | ||
| sb.WriteString(" source_ref=${refspec%%:*}\n") | ||
| sb.WriteString(" source_ref=${source_ref#+}\n") | ||
| sb.WriteString(" if " + gitPrefix + " -c \"http.extraheader=Authorization: Basic ${header}\" ls-remote --exit-code origin \"$source_ref\" > /dev/null; then\n") |
There was a problem hiding this comment.
Fixed in 9c4067d. Both checkout paths now validate complete discovered ref names against the source refspec while streaming discovery output. Added literal, wildcard, and PR suffix-collision regressions, plus a real-git runtime test with over 1 MB of discovery output that still fetches main. Focused Go tests, 180 runtime tests, and all 348 workflow drift checks pass.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated the checkout reference, syntax guidance, and Checkout Behavior Specification in 42aa2df, including unmatched-pattern examples, static/runtime behavior, fatal errors, authentication/depth preservation, and compliance requirements. Targeted Go tests and all 175 checkout JavaScript tests pass; the validation gate reports existing custom Go lint findings. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 85094d4
|
…fetch-abort-issue Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Merged latest main with Focused Go tests, impacted unit tests, 190 checkout/manifest JavaScript tests, type-checking, secret scanning, and all 348 workflow drift checks pass. Scoped standard Go lint passes; the gate remains blocked by pre-existing unchecked fmt.Fprintf findings. Full-repository lint and CodeQL timed out. CI was not triggered; human review and verification of CI/security checks remain. |
|
@copilot fix ci failures |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 7ab884e by raising the timeout for the two deep-history performance cases from 30s to 60s. The full affected test file and impacted setup-JS tests pass. The final repository gate remains blocked by existing unchecked |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in 5182615: the failing test expected the old unavailable |


A missing ref in
checkout.fetchcould abort the combined fetch, preventing existing refs from being fetched.git ls-remote --exit-code; skip only zero-match status 2, then fetch matching patterns separately.Fetches
maineven when nomy-prefix/branches exist.