refactor(lockfile): consume external github/actions-lockfile module - #26
refactor(lockfile): consume external github/actions-lockfile module#26nodeselector wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
⚠️ Not ready to approve
The refactor removes APIs still referenced elsewhere (breaking compilation) and includes a cross-platform persistence issue (Windows rename-overwrite) that should be addressed before approval.
Pull request overview
This PR refactors internal/lockfile to stop using the previously vendored lockfile implementation and instead consume the external github.com/github/actions-lockfile/go module, introducing a new on-disk lockfile state manager and deterministic YAML serialization.
Changes:
- Replace the old workflow/dependency parsing + diff helpers with a new
Stateabstraction backed by the externalactions-lockfiletypes. - Add deterministic lockfile marshaling and direct-dependency tracking to support stable output and accurate “direct vs transitive” classification.
- Update module dependencies (
go.mod/go.sum) to includegithub.com/github/actions-lockfile/goand refresh test dependencies.
File summaries
| File | Description |
|---|---|
internal/lockfile/state.go |
New lockfile state implementation: load/normalize, set workflow deps, GC, and persist the lockfile. |
internal/lockfile/state_marshal.go |
Deterministic YAML writer (stable ordering + quoting) for byte-stable lockfile output. |
internal/lockfile/state_test.go |
New tests covering tag/branch persistence, determinism, GC behavior, and future-version refusal behavior. |
internal/lockfile/direct_tracker.go |
Tracks which resolved deps are workflow-direct across ref normalization/mutation. |
internal/lockfile/convertor.go |
Dependency ↔ pin conversion helpers for bridging internal dep types and external lockfile pins. |
internal/lockfile/lockfile.go |
Removed legacy workflow parsing/dependency writing implementation. |
internal/lockfile/diff.go |
Removed legacy dependency diff/preserve-ref helpers. |
internal/lockfile/version.go |
Removed legacy semver parsing helpers. |
internal/lockfile/lockfile_test.go |
Removed legacy tests tied to removed workflow parsing/writing code. |
internal/lockfile/diff_test.go |
Removed tests tied to removed diff helpers. |
internal/lockfile/testdata/* |
Removed test fixtures no longer used by the deleted internal/lockfile tests. |
go.mod |
Adds github.com/github/actions-lockfile/go (pseudo-version) and updates testify. |
go.sum |
Reflects module graph changes (adds actions-lockfile, updates testify, removes unused deps). |
Copilot's findings
- Files reviewed: 16/17 changed files
- Comments generated: 3
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Package lockfile manages CLI lockfile state: loading, saving, and | ||
| // converting the on-disk format. | ||
| package lockfile |
| tmp := full + ".tmp" | ||
| if err := os.WriteFile(tmp, out, 0o644); err != nil { | ||
| return err | ||
| } | ||
| return os.Rename(tmp, full) |
| gopkg.in/yaml.v3 v3.0.1 | ||
| ) | ||
|
|
||
| require github.com/github/actions-lockfile/go v0.0.0-20260607192413-049be4ee6d5a |
032668f to
4a831ff
Compare
490e9a1 to
59fbf55
Compare
0d07228 to
91a607c
Compare
12bb8cd to
dc96b82
Compare
3194ff4 to
43cdacf
Compare
1145b9b to
208df2c
Compare
43cdacf to
1b3b81c
Compare
Drop the vendored pkg/lockfile tree and depend on the standalone github.com/github/actions-lockfile/go module. Lockfile diagnostics now live under internal/lockfile/diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1b3b81c to
7b5b776
Compare
208df2c to
85df9bf
Compare
|
Consolidated into #30. Closing this stacked PR. |
Layer 4/7. Base:
ns/release/pipeline.Drop the vendored
pkg/lockfiletree and depend on the standalonegithub.com/github/actions-lockfile/gomodule. Diagnostics now live underinternal/lockfile/diagnostics. Note: pinned to a pseudo-version; bump to a real semver tag once actions-lockfile cuts one. NeedsGOPRIVATE=github.com/githubto fetch.Part of a stacked series for the pre-release hardening of
gh actions-pin. Review bottom-up; each PR is based on the one below it so the diff shows only that layer.