Skip to content

Skip ripgrep apt install when rg already exists - #51915

Merged
pelikhan merged 3 commits into
mainfrom
copilot/skip-ripgrep-install-when-available-again
Aug 11, 2026
Merged

Skip ripgrep apt install when rg already exists#51915
pelikhan merged 3 commits into
mainfrom
copilot/skip-ripgrep-install-when-available-again

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Copilot-generated jobs were doing package-manager work even on runners that already provide rg. This keeps minimal-runner compatibility while avoiding unnecessary apt updates and privileged installs on pre-baked images.

  • Copilot setup generation
    • Add a conditional Install ripgrep step before Copilot CLI setup.
    • Probe for rg first and only install ripgrep when missing.
if command -v rg >/dev/null 2>&1; then
  rg --version
else
  sudo apt-get update -qq
  sudo apt-get install -y -qq ripgrep
fi
  • Generated outputs

    • Refresh Copilot workflow lock files and WASM golden fixtures to include the conditional setup step.
  • Release note

    • Add a patch changeset for the generated Copilot job optimization.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
run: bash "${RUNNER_TEMP}/gh-aw/actions/install_awf_binary.sh" v0.27.44
- name: Install ripgrep
run: |
if command -v rg >/dev/null 2>&1; then

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot refactor into a shell script in actions/setup/sh + add tests

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.

Addressed in ddbc80e: the generated step now calls actions/setup/sh/install_ripgrep.sh, with shell tests covering both the existing-rg and missing-rg paths wired into make test-scripts.

Copilot AI changed the title [WIP] Skip ripgrep apt install when rg is already available on custom runners Skip ripgrep apt install when rg already exists Aug 11, 2026
Copilot AI requested a review from pelikhan August 11, 2026 03:36
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review August 11, 2026 03:53
Copilot AI balanced review requested due to automatic review settings August 11, 2026 03:53
@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel completed test quality analysis.

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR does not have the 'implementation' label and has ≤100 new lines of code in business logic directories (53 additions detected).

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Ponytail Reviewer completed successfully!

Reviewed PR #51915 for over-engineering (ponytail-review). No findings: the shell script extraction and test file follow existing repo conventions (per-script _test.sh files like install_awf_binary_test.sh), the Go change is a single small function with no speculative abstraction, and the change directly implements the reviewer's own prior request to refactor into a script + tests. Lean already. Ship.

Generated by Ponytail Reviewer for #51915

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

Warning

Threat Detection Engine Failure — The analysis engine could not complete. This is a tooling failure, not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs for details.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • api.individual.githubcopilot.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "api.individual.githubcopilot.com"

See Network Configuration for more information.

🔎 Code quality review by PR Code Quality Reviewer

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds conditional ripgrep provisioning to generated Copilot jobs, avoiding package-manager work when rg already exists.

Changes:

  • Adds and tests a shared ripgrep installer.
  • Emits the installer before Copilot CLI setup.
  • Refreshes generated workflows, golden fixtures, and release metadata.
Show a summary per file
File Description
actions/setup/sh/install_ripgrep.sh Adds conditional installation logic.
actions/setup/sh/install_ripgrep_test.sh Tests present and missing rg paths.
pkg/workflow/copilot_engine_installation.go Generates the ripgrep setup step.
pkg/workflow/copilot_engine_test.go Updates installation-step assertions.
Makefile Runs the new shell tests.
.changeset/patch-copilot-ripgrep-install-probe.md Adds the patch release note.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/with-imports.golden Refreshes generated output.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden Refreshes generated output.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/playwright-cli-mode.golden Refreshes generated output.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/basic-copilot.golden Refreshes generated output.
pkg/workflow/testdata/TestWasmGolden_AllEngines/copilot.golden Refreshes generated output.
.github/workflows/*.lock.yml Refreshes affected compiled workflows with the setup step.

Review details

Tip

Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 203/203 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment on lines +11 to +13
echo "ripgrep not found; installing with apt-get..."
sudo apt-get update -qq
sudo apt-get install -y -qq ripgrep

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The install_ripgrep.sh script correctly short-circuits with command -v rg before falling back to apt-get, and all lock files are consistently updated. No blocking issues found.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · sonnet46 · 22.5 AIC · ⌖ 6.19 AIC · ⊞ 5.4K

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel

PR: #51915 — Skip ripgrep apt install when rg already exists


Result: No Test Changes Detected

This PR contains 203 changed files (1065 additions, 18 deletions), primarily:

  • Generated lock files and WASM golden fixtures refreshed to include the conditional rg install step
  • A patch changeset entry
  • Source changes to the Copilot engine generator

The file pkg/workflow/copilot_engine_test.go appears in the changed files list, but no test functions were added or modified — the diff for that file is empty.

All pre-fetch signal files were empty:

  • go-new-test-funcs.txt — no new func Test* functions
  • go-modified-test-funcs.txt — no modified test functions
  • js-new-test-funcs.txt — no new JS test blocks
  • go-testmain-funcs.txt — no TestMain infrastructure changes
  • go-goleak-entries.txt — no goroutine-leak guard changes
  • missing-build-tags.txt — no violations

No violations detected.

i️ The production change (conditional rg probe before apt install) is not covered by a new test in this PR. This is acceptable for generated-output changes where the golden fixtures serve as regression tests.


Score: N/A — No test functions added or modified. Test Quality Sentinel skipped scoring.

🧪 Test quality analysis by Test Quality Sentinel · sonnet46 · 31.8 AIC · ⌖ 6.68 AIC · ⊞ 7.6K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: N/A — No test functions added or modified in this PR. No violations detected.

@github-actions github-actions Bot mentioned this pull request Aug 11, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs — the implementation is correct and well-tested. Approving.

Positive Highlights

  • ✅ Probe-first pattern (command -v rg) correctly skips apt on pre-baked runners
  • ✅ Shell script extracted from inline YAML — cleaner, reusable, and version-controlled
  • ✅ Both paths covered by install_ripgrep_test.sh
  • ✅ Go unit tests assert the ripgrep step is first and uses the script path
  • ✅ Lock files properly recompiled

Minor Observation

install_ripgrep.sh falls back to apt-get (Linux-only). If macOS runner support is ever needed, a uname -s branch would be required — not blocking for current usage.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 · 75.9 AIC · ⌖ 6.45 AIC · ⊞ 7.1K
Comment /matt to run again

@pelikhan
pelikhan merged commit ed2882d into main Aug 11, 2026
99 of 116 checks passed
@pelikhan
pelikhan deleted the copilot/skip-ripgrep-install-when-available-again branch August 11, 2026 04:02
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.86.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip ripgrep apt install when rg is already available on custom runners

3 participants