Skip to content

Commit 660f278

Browse files
authored
Merge pull request #4 from github/ns/self-feedback
fix: clean up cruft, prep for feedback
2 parents 9b279ef + cf6260d commit 660f278

4 files changed

Lines changed: 31 additions & 236 deletions

File tree

README.md

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
# gh-actions-pin
22

3-
Lock and verify GitHub Actions workflow dependencies from the command line.
4-
5-
This extension resolves `uses:` references to their current commit SHAs and
6-
previews the resulting inline `dependencies:` changes by default. Use `--write`
7-
to apply them. It also supports validation, targeted refreshes, ref upgrades,
8-
and lockfile cleanup.
9-
10-
When a workflow's direct action refs have changed since the last lock, the
11-
write path refuses to silently bless those edits by default. Use `upgrade` for
12-
intentional bumps, or pass `--allow-ref-changes` if you really mean it.
3+
Manage your workflow dependencies.
134

145
## Install
156

@@ -19,41 +10,5 @@ gh extension install github/gh-actions-pin
1910

2011
## Usage
2112

22-
```bash
23-
# Preview all workflows in .github/workflows/
24-
gh actions-pin
25-
26-
# Write the proposed lockfile changes
27-
gh actions-pin --write
28-
29-
# Explicitly acknowledge direct workflow ref edits
30-
gh actions-pin --write --allow-ref-changes
31-
32-
# Preview a specific workflow and inspect the proposed delta
33-
gh actions-pin .github/workflows/ci.yml --diff
34-
35-
# Check the current lock state
36-
gh actions-pin check
37-
38-
# Refresh a targeted action
39-
gh actions-pin update --action actions/checkout
40-
41-
# Upgrade a workflow action to the latest stable tag and repin it
42-
gh actions-pin upgrade --action actions/checkout --write
43-
44-
# Upgrade to a specific version
45-
gh actions-pin upgrade --action actions/checkout --version v5 --write
46-
47-
# Upgrade only checkout refs currently on v5 to v6
48-
gh actions-pin upgrade --action actions/checkout --from v5 --version v6 --write
49-
50-
# Remove stale entries
51-
gh actions-pin tidy
52-
```
53-
54-
## Notes
13+
Run through the UX feedback loop [here](https://github.com/github/gh-actions-pin/discussions/3).
5514

56-
- with no arguments, the extension discovers workflow files under `.github/workflows/`
57-
- local path actions (`uses: ./path`) are currently skipped
58-
- the default preview prints a compact summary and points you at `--diff` for closer review
59-
- use `--hostname` if you need to target a specific GitHub Enterprise host

command_test.go

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ jobs:
156156
- uses: actions/setup-go@v6
157157
`)
158158

159-
stdout, stderr, err := runCommandWithHTTP(t, reg, "--diff", workflowPath)
159+
stdout, stderr, err := runCommandWithHTTP(t, reg, workflowPath)
160160
require.NoError(t, err)
161161
assert.Empty(t, stdout)
162162
assert.Contains(t, stderr, "Resolving 2 action reference(s)...")
@@ -272,7 +272,7 @@ dependencies:
272272
`)
273273

274274
stdout, stderr, err := runCommandWithHTTP(t, reg,
275-
"update", "--action", "github.com/actions/checkout", workflowPath,
275+
"update", "--action", "github.com/actions/checkout", "--write", workflowPath,
276276
)
277277
require.NoError(t, err)
278278
assert.Empty(t, stdout)
@@ -285,38 +285,6 @@ dependencies:
285285
assert.Contains(t, got, "github.com/actions/setup-go@v6:sha1-4a3601121dd01d1626a1e23e37211e3254c1c06c")
286286
}
287287

288-
func TestTidyCommand_RemovesStaleEntries(t *testing.T) {
289-
reg := &httpmock.Registry{}
290-
defer reg.Verify(t)
291-
292-
workflowPath := writeTempWorkflow(t, `
293-
name: ci
294-
on: push
295-
jobs:
296-
test:
297-
runs-on: ubuntu-latest
298-
steps:
299-
- uses: actions/checkout@v6
300-
301-
# Automatically generated and managed by: gh actions-pin --write <workflow-path>
302-
dependencies:
303-
- github.com/actions/checkout@v6:sha1-de0fac2e4500dabe0009e67214ff5f5447ce83dd
304-
- github.com/actions/setup-go@v6:sha1-4a3601121dd01d1626a1e23e37211e3254c1c06c
305-
`)
306-
307-
stdout, stderr, err := runCommandWithHTTP(t, reg, "tidy", workflowPath)
308-
require.NoError(t, err)
309-
assert.Empty(t, stdout)
310-
assert.Contains(t, stderr, "Tidied 1 dependencies")
311-
assert.Contains(t, stderr, "removed 1 stale")
312-
313-
content, readErr := os.ReadFile(workflowPath)
314-
require.NoError(t, readErr)
315-
got := string(content)
316-
assert.Contains(t, got, "github.com/actions/checkout@v6")
317-
assert.NotContains(t, got, "github.com/actions/setup-go@v6")
318-
}
319-
320288
const nodeActionYAML = "name: Test Action\nruns:\n using: node20\n"
321289

322290
func testRepoResponse(nameWithOwner, oid, actionYAML string) map[string]any {

0 commit comments

Comments
 (0)