Skip to content

Comments

Auto-recover .github folder after sparse-checkout in custom steps#16181

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/fix-runtime-import-error
Closed

Auto-recover .github folder after sparse-checkout in custom steps#16181
Copilot wants to merge 4 commits intomainfrom
copilot/fix-runtime-import-error

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Workflows using git sparse-checkout in custom steps were removing .github folder, causing runtime imports to fail with "Runtime import file not found". The compiler now detects sparse-checkout usage and automatically re-checks out .github and .agents before processing runtime imports.

Changes

  • Detection: Added ContainsSparseCheckout() to identify git sparse-checkout patterns in custom steps
  • Recovery: Added generateSparseCheckoutRecoveryStep() to inject checkout step when needed
  • Integration: Modified main job generation to insert recovery step before prompt creation

The recovery step is only generated when both conditions are met:

  1. Custom steps contain git sparse-checkout commands
  2. Workflow uses runtime imports (has ImportPaths or MainWorkflowMarkdown)

Example

Workflow with sparse-checkout:

steps:
  - name: Checkout source only
    run: |
      git sparse-checkout init --cone
      git sparse-checkout set src

Compiled output now includes:

- name: Checkout source only
  run: |
    git sparse-checkout init --cone
    git sparse-checkout set src
# ... other steps ...
- name: Re-checkout .github and .agents after sparse-checkout
  uses: actions/checkout@v6
  with:
    sparse-checkout: |
      .github
      .agents
- name: Create prompt with built-in context  # runtime-import succeeds

Files

  • pkg/workflow/permissions.go - Detection logic
  • pkg/workflow/compiler_yaml_helpers.go - Recovery step generator
  • pkg/workflow/compiler_yaml_main_job.go - Integration
  • pkg/workflow/sparse_checkout_recovery_test.go - Test coverage
  • docs/src/content/docs/guides/sparse-checkout.md - User guide

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v2 --jq .object.sha HEAD (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha HEAD .cfg 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha (http block)
    • Triggering command: `/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha 8fl6aaGAo nsSparseCheckout() to detect git sparse-checkout usage
  • Add generateSparseCheckoutRecoveryStep(-C 64/pkg/tool/linux_amd64/vet` (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v7
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha --local pull.rebase 64/pkg/tool/linux_amd64/vet o "Please install Node.js 20+ and try again."; \ echo ""; \ echo "For installation instructio (http block)
    • Triggering command: `/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha --noprofile nsSparseCheckout() to detect git sparse-checkout usage
  • Add generateSparseCheckoutRecoveryStep(-C 64/pkg/tool/linux_amd64/vet` (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha FETCH_HEAD (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha /a.out st.go 64/pkg/tool/linu../../../.prettierignore t.go -0c8N6F35d4uHWIlls-files integration_test--exclude-standard 64/pkg/tool/linu--others on_t�� js/**/*.json' --ignore-path ../../../.prettierignore always_declared_test.go 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha --local credential.usern--ignore-path 64/pkg/tool/linu../../../.prettierignore (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha --local credential.helper 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha g_.a credential.usern--ignore-path 64/pkg/tool/linu../../../.prettierignore (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha --local credential.usern--ignore-path /prettier (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha --local credential.usern--ignore-path /node (http block)
  • https://api.github.com/repos/anchore/sbom-action/git/ref/tags/v0
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha --noprofile .cfg ode (http block)
    • Triggering command: /usr/bin/gh gh api /repos/anchore/sbom-action/git/ref/tags/v0 --jq .object.sha json' --ignore-path ../../../.pr**/*.json .cfg 64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6
    • Triggering command: `/usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha --noprofile nsSparseCheckout() to detect git sparse-checkout usage
  • Add generateSparseCheckoutRecoveryStep(-C 64/pkg/tool/linux_amd64/vet` (http block)
  • Triggering command: /usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha json' --ignore-path ../../../.pr**/*.json .cfg de/node/bin/bash (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha json' --ignore-path ../../../.pr**/*.json .cfg node (http block)
  • https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha json' --ignore-path ../../../.pr**/*.json .cfg 64/bin/bash (http block)
  • https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3
    • Triggering command: `/usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha --noprofile nsSparseCheckout() to detect git sparse-checkout usage
  • Add generateSparseCheckoutRecoveryStep(-C 64/pkg/tool/linux_amd64/vet` (http block)
  • Triggering command: /usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha json' --ignore-path ../../../.pr**/*.json .cfg ules/.bin/prettier (http block)
  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login pkg/workflow/action_resolver_test.go pkg/workflow/action_sha_checker.go pkg/workflow/action_sha_checker_integration_test.go pkg/workflow/action_sha_checker_test.go pkg/workflow/action_sha_validation_test.go pkg/workflow/activation_checkout_test.go pkg/workflow/activation_outputs_always_declared_test.go (http block)
    • Triggering command: `/usr/bin/gh gh api user --jq .login get --local 64/pkg/tool/linux_amd64/vet pull.rebase ) to re-checkout .github/.agents
  • Insert recovery step before prompt generation whe�� d163ba09 64/pkg/tool/linux_amd64/vet rev-�� js/**/*.json' --ignore-path ../../../.prettierignore .cfg 64/pkg/tool/linux_amd64/vet` (http block)
  • Triggering command: /usr/bin/gh gh api user --jq .login re user.email 64/pkg/tool/linux_amd64/vet (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>a3-python regression</issue_title>
<issue_description>I created an AW last week that ran a few times.
https://github.com/Z3Prover/z3/actions/workflows/a3-python.lock.yml
It regressed and the auto-fix options don't make progress.</issue_description>

Comments on the Issue (you are @copilot in this section)

@pelikhan See error:

Error: Failed to process runtime import for .github/workflows/a3-python.md: Runtime import file not found: workflows/a3-python.md

Investigate issue in runtime import path resolution logic.</comment_new>


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.



✨ PR Review Safe Output Test - Run 22074698565

💥 [THE END] — Illustrated by Smoke Claude

Copilot AI and others added 2 commits February 16, 2026 19:10
- Add ContainsSparseCheckout() to detect git sparse-checkout usage
- Add generateSparseCheckoutRecoveryStep() to re-checkout .github/.agents
- Insert recovery step before prompt generation when sparse-checkout detected
- Add comprehensive unit tests for sparse checkout detection and recovery
- Fixes issue where runtime imports fail after sparse-checkout removes .github

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix runtime import path resolution for a3-python regression Auto-recover .github folder after sparse-checkout in custom steps Feb 16, 2026
Copilot AI requested a review from pelikhan February 16, 2026 19:16
@pelikhan pelikhan closed this Feb 16, 2026
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.

a3-python regression

2 participants