Skip to content

Commit 920224a

Browse files
committed
catalog: add scenarios for branch-ref narrowing and local-path-only workflows
New scenarios: - fresh_branch_ref_narrows: @main on public action narrows to full semver - fresh_branch_ref_no_narrow: --no-narrow keeps @main as-is - onboarded_branch_ref_narrows: verified dep at @main gets narrowed on repin - local_action_only: workflow with only local path steps, no remote refs Replaces the now-wrong fresh_branch_ref_skipped which asserted @main stayed as main (before non-semver narrowing was added).
1 parent 95ef75c commit 920224a

2 files changed

Lines changed: 69 additions & 2 deletions

File tree

test/integration/run.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,26 @@ def golden_json_diff(expected, actual, path)
373373
}
374374
)
375375
},
376+
# Lockfile with a branch-ref dep key (main) — represents a workflow
377+
# onboarded with --no-narrow that should be narrowed on re-pin.
378+
"pinned_checkout_main" => -> {
379+
build_lockfile(
380+
workflows: {
381+
".github/workflows/ci.yml" => [
382+
"actions/checkout@main:sha1-#{CHECKOUT_SHA}"
383+
]
384+
},
385+
dependencies: {
386+
"actions/checkout@main:sha1-#{CHECKOUT_SHA}" => {
387+
"tag" => "",
388+
"branch" => "main",
389+
"commit" => "sha1-#{CHECKOUT_SHA}",
390+
"owner_id" => 44036562,
391+
"repo_id" => 197814629
392+
}
393+
}
394+
)
395+
},
376396
"future_version" => -> {
377397
<<~YAML
378398
# This file is machine-generated by `gh actions-lock`.

test/scenarios/catalog.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,10 +652,24 @@ scenarios:
652652
exit: 0
653653
lockfile_comment_matches: 'v4\.2\.0'
654654

655-
- name: fresh_branch_ref_skipped
655+
- name: fresh_branch_ref_narrows
656656
category: narrowing
657-
description: "Branch ref (main) is not a semver — narrowing skips it"
657+
description: "Branch ref (main) on public action narrows to full semver"
658658
needs_token: true
659+
fixtures:
660+
workflows:
661+
ci.yml:
662+
name: CI
663+
actions: ["actions/checkout@main"]
664+
expect:
665+
exit: 0
666+
lockfile_comment_matches: 'v\d+\.\d+\.\d+'
667+
668+
- name: fresh_branch_ref_no_narrow
669+
category: narrowing
670+
description: "--no-narrow: branch ref (main) stays as main"
671+
needs_token: true
672+
flags: ["--no-narrow"]
659673
fixtures:
660674
workflows:
661675
ci.yml:
@@ -665,6 +679,39 @@ scenarios:
665679
exit: 0
666680
lockfile_comment_matches: 'main'
667681

682+
- name: onboarded_branch_ref_narrows
683+
category: narrowing
684+
description: "Onboarded workflow at @main — verified dep narrowing upgrades to full semver"
685+
needs_token: true
686+
fixtures:
687+
workflows:
688+
ci.yml:
689+
name: CI
690+
actions: ["actions/checkout@main"]
691+
lockfile_template: pinned_checkout_main
692+
expect:
693+
exit: 0
694+
lockfile_comment_matches: 'v\d+\.\d+\.\d+'
695+
696+
- name: local_action_only
697+
category: workflow_parsing
698+
description: "Workflow with only local path actions (no remote refs) — skipped cleanly"
699+
needs_token: true
700+
fixtures:
701+
workflows:
702+
ci.yml:
703+
raw: |
704+
name: CI
705+
on: push
706+
jobs:
707+
build:
708+
runs-on: ubuntu-latest
709+
steps:
710+
- uses: ./.github/actions/my-action
711+
- uses: ./.github/actions/other-action
712+
expect:
713+
exit: 0
714+
668715
- name: fresh_no_narrow_keeps_major
669716
category: narrowing
670717
description: "--no-narrow: splat ref v4 stays v4 in lockfile (not narrowed to v4.x.y)"

0 commit comments

Comments
 (0)