Skip to content

feat: add optional actions-lock integration to compile - #72395

Merged
pelikhan merged 4 commits into
mainfrom
pelikhan-refactored-spork
Oct 27, 2026
Merged

pelikhan merged 4 commits into
mainfrom
pelikhan-refactored-spork

Conversation

@pelikhan

@pelikhan pelikhan commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Allow users to maintain the standard Actions dependency lockfile during compilation without replacing gh-aw's existing pin cache or requiring the extension for ordinary compilation.

  • Add gh aw compile --actions-lock to invoke gh actions-lock --no-narrow from the repository root after successful compilation and companion workflow generation. The extension scans its default workflow directory, including when compiling specific files.
  • Never install the extension automatically. Propagate failures with installation guidance, preserve compiled files, and send extension output to stderr so compiler JSON remains valid.
  • Reject combinations with --no-emit, --read-only, --watch, and --dry-run. Dry-run compilation still intentionally emits compiler files; broader extension-owned post-processing is excluded.
  • Preserve the shared GitHub CLI helper's enterprise host, credentials, token precedence, configuration, and certificate environment. Add subprocess regression coverage for explicit and origin-detected hosts. Upstream extension host support is unchanged.

The existing .github/aw/actions-lock.json and action pin resolution remain in place. This is a scoped first step toward #70264, not a complete resolution.

ADR: ADR-72395: Delegate Actions Lockfile Maintenance to the gh-actions-lock Extension

Validation

  • make build and make fmt passed.
  • Focused Go tests passed for flag plumbing, successful and failed compilation, missing extensions, JSON output, cancellation, repository-root execution, and enterprise environment forwarding. Review regressions also cover dry-run rejection, extension non-invocation, existing lockfile preservation, and physical repository paths.
  • make check-workflow-drift passed for all 349 workflows, including after the review fixes.
  • BASE_REF=HEAD make agent-report-progress-no-test passed for the enterprise follow-up before its commit.
  • The full branch make agent-report-progress ran impacted tests successfully but was blocked by pre-existing custom-linter findings in unchanged functions. The review-batch no-test gate likewise reports only the existing function-length findings in CompileWorkflowWithValidation and CompileWorkflowDataWithValidation; standard Go lint and schema freshness passed.

pelikhan and others added 2 commits October 27, 2026 10:23
Add compile --actions-lock to invoke gh actions-lock --no-narrow after successful compilation without installing the extension. Preserve JSON output and reject incompatible emission/watch modes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cover explicit and origin-detected hosts, enterprise credentials, public fallback tokens, GitHub token precedence, and inherited configuration and certificate settings.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review October 27, 2026 10:35
Copilot AI max review requested due to automatic review settings October 27, 2026 10:35
@github-actions

Copy link
Copy Markdown
Contributor

Commit pushed: 1cb25f9

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus55 · ~27 AIC · ⌖ ~42 AIC · ⊞ 1.9K

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (270 new lines in pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/72395-delegate-actions-lockfile-to-gh-actions-lock-extension.md. Review and complete it before merging.

Decision captured: add an opt-in gh aw compile --actions-lock flag. It runs the external gh actions-lock --no-narrow extension through ExecGHContext after a successful compile. It does not reimplement the lockfile, does not auto-install the extension, and keeps .github/aw/actions-lock.json unchanged.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.
  2. Complete the missing sections: add context the AI could not infer, refine the decision rationale, and list the real alternatives you considered (for example, native lockfile generation or replacing .github/aw/actions-lock.json).
  3. Commit the finalized ADR to docs/adr/ on your branch.
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-72395: Delegate Actions Lockfile Maintenance to the gh-actions-lock Extension

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide? Why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · opus55 · ~27 AIC · ⌖ ~42 AIC · ⊞ 1.9K · ◷
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.

Review summary

No actionable blocking issues found in the changed lines. The implementation correctly gates the optional extension, preserves JSON stdout by forwarding extension output to stderr, validates incompatible modes, runs from the repository root, and propagates failures. Static review only; the specialist pass was unavailable because its diff-read tool invocation was denied.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.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.

Skills-Based Review 🧠

Applied /tdd and /codebase-design — requesting changes on a validation gap that lets --dry-run --actions-lock mutate the real repository lockfile.

📋 Key Themes & Highlights

Key Themes

  • Validation gap (primary): validateCompileConfig rejects --actions-lock combined with --no-emit/--read-only/--watch, but not --dry-run. Since dry-run already forces lock-file emission, this combo would invoke the live gh actions-lock --no-narrow extension during what the compiler documents as a mutation-free dry run (dryRunScopeMessage). Flagged as inline comments on compile_validation.go and the missing regression test in compile_actions_lock_test.go.
  • Architectural divergence: ActionsLock is wired as a single top-level post-compile hook in CompileWorkflows, while the existing Dependabot flag lives inside the per-pipeline runPostProcessing* functions. Non-blocking, but worth a note so the post-compile side effect placement question does not fork further.

Positive Highlights

  • ✅ Strong test coverage overall: flag plumbing, success/failure paths, missing-extension guidance, JSON/stderr output isolation, repo-root execution, and enterprise env forwarding are all exercised with fake gh scripts.
  • ✅ Clear, actionable error message when the gh-actions-lock extension is not installed.
  • ✅ Careful isolation of extension output to stderr so --json stdout stays parseable.

Note: triage via the pr-triage agent recommended /tdd and /grill-with-docs; I additionally applied /codebase-design given the orchestration-placement question, and prioritized the dry-run safety gap as the highest-impact, concrete finding.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · sonnet50 · ~151 AIC · ⌖ ~17 AIC · ⊞ 10.2K
Comment /matt to run again

Comment thread pkg/cli/compile_actions_lock_test.go
Comment thread pkg/cli/compile_validation.go
Comment thread pkg/cli/compile_orchestrator.go

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.

🟡 Changes recommended

The repository-root regression test can fail on symlinked temporary directories because it compares logical and physical paths.

1 open issue
What changed in this PR

Adds optional Actions dependency locking to gh aw compile while preserving gh-aw’s existing action-pin cache and ordinary compilation behavior.

Changes:

  • Adds --actions-lock to run the separately installed extension after successful compilation.
  • Preserves subprocess environment settings and JSON output, and rejects incompatible compile modes.
  • Documents the integration and adds flag, execution, failure, and enterprise-environment coverage.
File Description
pkg/​cli/​compile_validation.go Rejects incompatible flag combinations.
pkg/​cli/​compile_orchestrator.go Runs the extension from the repository root after compilation.
pkg/​cli/​compile_config.go Adds the actions-lock configuration option.
pkg/​cli/​compile_actions_lock_test.go Covers extension execution, failures, environment forwarding, and cancellation.
docs/​src/​content/​docs/​setup/​cli.md Documents installation, behavior, and restrictions.
cmd/​gh-aw/​main.go Registers the flag and forwards its value.
cmd/​gh-aw/​compile_flags_test.go Verifies the flag default and configuration plumbing.

Review effort: Max

Comment thread pkg/cli/compile_actions_lock_test.go Outdated
Reject extension post-processing during dry-run, cover lockfile preservation, document once-per-run ordering, and finalize the proposed ADR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copy link
Copy Markdown
Collaborator Author

In response to #72395 (comment): completed the ADR's context, alternatives, consequences, and remaining limitations in 0f9f282. The finalized ADR is now linked in the PR description.

Copy link
Copy Markdown
Collaborator Author

In response to #72395 (comment): reviewed and completed the generated ADR in 0f9f282. Its status remains Proposed pending review of this PR.

@pelikhan
pelikhan merged commit c6de274 into main Oct 27, 2026
74 checks passed
@pelikhan
pelikhan deleted the pelikhan-refactored-spork branch October 27, 2026 11:35
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.0.1

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.

2 participants