Skip to content

Handle empty script matches in copilot setup workflow with find#3499

Merged
plengauer merged 2 commits into
mainfrom
copilot/fix-job-failure-on-no-matching-file
May 29, 2026
Merged

Handle empty script matches in copilot setup workflow with find#3499
plengauer merged 2 commits into
mainfrom
copilot/fix-job-failure-on-no-matching-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 24, 2026

The Copilot setup workflow failed when no files matched the *-action-*/*/*.sh glob. This change makes the step no-op in that case while still printing matched scripts when present.

  • Problem

    • The existing shell glob iteration treated an unmatched wildcard as a literal path, causing the step to fail.
  • Change

    • Replaced glob-based for iteration with a find pipeline scoped to ${RUNNER_TEMP} and the same path shape.
    • Kept output behavior unchanged for matched files (echo header + cat content + separator).
  • Resulting behavior

    • Zero matches: prints nothing, exits cleanly.
    • One or more matches: prints each script as before.
- run: |
    printenv
    find "${RUNNER_TEMP}" -type f -path "${RUNNER_TEMP}/*-action-*/*/*.sh" | while IFS= read -r script_file; do
      echo "########## $script_file"
      cat "$script_file"
      echo "##############################"
    done

Copilot AI changed the title Use find to avoid wildcard failures in copilot setup workflow Handle empty script matches in copilot setup workflow with find May 24, 2026
Copilot AI requested a review from plengauer May 24, 2026 08:37
@plengauer
Copy link
Copy Markdown
Owner

Hello, thanks for contributing for the first time!

@plengauer plengauer marked this pull request as ready for review May 24, 2026 08:51
@plengauer plengauer requested a review from moflwi as a code owner May 24, 2026 08:51
Copilot AI review requested due to automatic review settings May 24, 2026 08:51
@plengauer plengauer enabled auto-merge (squash) May 24, 2026 08:51
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 copilot-setup-steps GitHub Actions workflow to avoid failures when the *-action-*/*/*.sh pattern has zero matches, by switching from shell glob iteration to a find-driven loop over ${RUNNER_TEMP}.

Changes:

  • Replaced glob-based for iteration with find ... | while read ... to make the step a no-op when there are no matching scripts.
  • Preserved the existing per-script log output format (header, file contents, separator).

Comment thread .github/workflows/copilot-setup-steps.yml Outdated
Comment thread .github/workflows/copilot-setup-steps.yml Outdated
@plengauer plengauer disabled auto-merge May 29, 2026 08:06
@plengauer plengauer merged commit da2fe27 into main May 29, 2026
9 of 24 checks passed
@plengauer plengauer deleted the copilot/fix-job-failure-on-no-matching-file branch May 29, 2026 08:06
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.

4 participants