Use YAML anchors to reduce boilerplate in e2e-versions workflow#1126
Conversation
No-behavior-change refactor. Introduces a `&checkout_step` anchor for the identical Checkout step (aliased via `*checkout_step` in the other 16 jobs) and a `&default_os` anchor for the common `[macos-latest, windows-latest, ubuntu-latest]` matrix list (aliased via `*default_os` in the 11 other jobs that use that exact list). Lists that differ (macos-15-intel, ubuntu-latest only, windows-latest+ubuntu-22.04) are left untouched. Once anchors are expanded the document is byte-for-byte equivalent to the original. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR refactors the e2e-versions GitHub Actions workflow to reduce duplication by introducing YAML anchors/aliases for the repeated Checkout step and the common OS matrix list, while keeping job logic and matrices intact.
Changes:
- Introduced a
&checkout_stepanchor for the sharedactions/checkout@v7step and replaced repeated copies with*checkout_step. - Introduced a
&default_osanchor for[macos-latest, windows-latest, ubuntu-latest]and replaced repeated occurrences with*default_os.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/e2e-versions.yml |
Replaces repeated checkout steps and common OS matrix lists with YAML anchors/aliases to reduce boilerplate. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Low
|
@copilot resolve the merge conflicts in this pull request |
Resolved. The merge conflict in |
Summary
Pure DRY/formatting refactor of
.github/workflows/e2e-versions.yml— no change to behavior, coverage, matrix values, step order, or names. Once the YAML anchors are expanded, the document is byte-for-byte equivalent to the original.What changed
Checkoutstep (actions/checkout@v7withpersist-credentials: false) was repeated 17 times. Anchored at its first occurrence with&checkout_stepand replaced the other 16 with the alias*checkout_step.[macos-latest, windows-latest, ubuntu-latest]was repeated 12 times. Anchored at its first occurrence with&default_osand aliased (*default_os) in the other 11 jobs that use that exact list. Lists that differ (e.g. containingmacos-15-intel,[ubuntu-latest], or[windows-latest, ubuntu-22.04]) were left untouched.Anchors are defined inline at their first real usage (no top-level definitions block), since GitHub Actions rejects arbitrary top-level keys. YAML anchors are resolved by the parser before Actions schema validation, so inline
&/*is valid.Net:
30 insertions(+), 77 deletions(-).Validation
new == orig), still 17 jobs, each retaining its Checkout / setup-java / verify steps.actionlint: it reports only pre-existing schema notices (matrixversion: 8,matrix.version/matrix.architectureexpression properties) that exist independently of this change — no anchor/alias errors were introduced.