Skip to content

refactor(lockfile): consume external github/actions-lockfile module - #26

Closed
nodeselector wants to merge 2 commits into
ns/release/pipelinefrom
ns/release/lockfile
Closed

refactor(lockfile): consume external github/actions-lockfile module#26
nodeselector wants to merge 2 commits into
ns/release/pipelinefrom
ns/release/lockfile

Conversation

@nodeselector

Copy link
Copy Markdown
Collaborator

Layer 4/7. Base: ns/release/pipeline.

Drop the vendored pkg/lockfile tree and depend on the standalone github.com/github/actions-lockfile/go module. Diagnostics now live under internal/lockfile/diagnostics. Note: pinned to a pseudo-version; bump to a real semver tag once actions-lockfile cuts one. Needs GOPRIVATE=github.com/github to 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ 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 State abstraction backed by the external actions-lockfile types.
  • 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 include github.com/github/actions-lockfile/go and 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.

Comment on lines +1 to +3
// Package lockfile manages CLI lockfile state: loading, saving, and
// converting the on-disk format.
package lockfile
Comment on lines +376 to +380
tmp := full + ".tmp"
if err := os.WriteFile(tmp, out, 0o644); err != nil {
return err
}
return os.Rename(tmp, full)
Comment thread go.mod
gopkg.in/yaml.v3 v3.0.1
)

require github.com/github/actions-lockfile/go v0.0.0-20260607192413-049be4ee6d5a
@nodeselector
nodeselector force-pushed the ns/release/pipeline branch from 032668f to 4a831ff Compare June 8, 2026 03:13
@nodeselector
nodeselector force-pushed the ns/release/lockfile branch 2 times, most recently from 490e9a1 to 59fbf55 Compare June 8, 2026 03:32
@nodeselector
nodeselector force-pushed the ns/release/pipeline branch 2 times, most recently from 0d07228 to 91a607c Compare June 8, 2026 05:39
@nodeselector
nodeselector force-pushed the ns/release/lockfile branch 2 times, most recently from 12bb8cd to dc96b82 Compare June 8, 2026 05:57
@nodeselector
nodeselector force-pushed the ns/release/pipeline branch 2 times, most recently from 3194ff4 to 43cdacf Compare June 8, 2026 13:01
@nodeselector
nodeselector force-pushed the ns/release/lockfile branch 2 times, most recently from 1145b9b to 208df2c Compare June 8, 2026 13:10
@nodeselector
nodeselector force-pushed the ns/release/pipeline branch from 43cdacf to 1b3b81c Compare June 8, 2026 13:10
nodeselector and others added 2 commits June 8, 2026 08:45
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>
@nodeselector
nodeselector force-pushed the ns/release/pipeline branch from 1b3b81c to 7b5b776 Compare June 8, 2026 13:46
@nodeselector
nodeselector force-pushed the ns/release/lockfile branch from 208df2c to 85df9bf Compare June 8, 2026 13:46
@nodeselector

Copy link
Copy Markdown
Collaborator Author

Consolidated into #30. Closing this stacked PR.

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