Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pkg/workflow/action_pins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func TestApplyActionPinToStep(t *testing.T) {
},
},
expectPinned: true,
expectedUses: "actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6",
expectedUses: "actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6",
},
{
name: "step with unpinned action",
Expand Down Expand Up @@ -297,9 +297,9 @@ func TestApplyActionPinToStep(t *testing.T) {
func TestGetActionPinsSorting(t *testing.T) {
pins := getActionPins()

// Verify we got all the pins (30 as of March 2026)
if len(pins) != 30 {
t.Errorf("getActionPins() returned %d pins, expected 30", len(pins))
// Verify we got all the pins (32 as of March 2026)
if len(pins) != 32 {
t.Errorf("getActionPins() returned %d pins, expected 32", len(pins))
Comment on lines +300 to +302

Copilot AI Mar 4, 2026

Copy link

Choose a reason for hiding this comment

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

This assertion hard-codes the total number of action pins, which will require updating this test every time action_pins.json changes. Consider asserting properties that don’t depend on the exact count (e.g., len(pins) > 0 plus spot-checking a few known pins, or comparing against the embedded JSON’s entry count if you expose it), so the test keeps validating sorting behavior without frequent churn.

Suggested change
// Verify we got all the pins (32 as of March 2026)
if len(pins) != 32 {
t.Errorf("getActionPins() returned %d pins, expected 32", len(pins))
// Verify we got at least one pin
if len(pins) == 0 {
t.Errorf("getActionPins() returned no pins")

Copilot uses AI. Check for mistakes.
}

// Verify they are sorted by version (descending) then by repository name (ascending)
Expand Down Expand Up @@ -345,7 +345,7 @@ func TestGetActionPinByRepo(t *testing.T) {
repo: "actions/setup-node",
expectExists: true,
expectRepo: "actions/setup-node",
expectVer: "v6.2.0",
expectVer: "v6.3.0",
},
{
repo: "unknown/action",
Expand Down Expand Up @@ -407,7 +407,7 @@ func TestApplyActionPinToTypedStep(t *testing.T) {
},
},
expectPinned: true,
expectedUses: "actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6",
expectedUses: "actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6",
},
{
name: "step with unpinned action",
Expand Down Expand Up @@ -1396,7 +1396,7 @@ func TestMapToStepWithActionPinning(t *testing.T) {
},
},
wantErr: false,
expectedUses: "actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6",
expectedUses: "actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6",
},
}

Expand Down