Skip to content

fix(workflows): parse job-level uses: (reusable workflow calls) - #45

Open
sroberts wants to merge 1 commit into
mainfrom
fix/workflow-job-uses
Open

fix(workflows): parse job-level uses: (reusable workflow calls)#45
sroberts wants to merge 1 commit into
mainfrom
fix/workflow-job-uses

Conversation

@sroberts

Copy link
Copy Markdown
Owner

Last of the AST gaps found while diagnosing #42. Raised in that PR's investigation, left out of scope because it wasn't the cause there.

The gap

A job that calls a reusable workflow has no steps::

jobs:
  lint:
    uses: acme/.github/.github/workflows/golangci-lint.yml@main

rawJob had no Uses field, so this parsed as a job with zero steps. Every workflow signal walks steps, so the job read as empty and the lint gate scored as absent. Splitting lint or build into a shared org workflow is a normal layout — and it looked to plumbline like a repo that doesn't lint.

Changes

  • Job.Uses and Job.With parsed; IsReusableCall() helper.
  • AnyUsesMatches(re) checks uses: at both step and job scope.
  • UsesAction(prefix) now checks job scope too — that fixes it for every signal calling it, not only the L3 gates.
  • l3.build-lint-gate uses both: a reusable workflow whose path names a recognized linter matches at medium confidence; one that merely looks lint-shaped falls to the low-confidence name path, same treatment as a step named Lint running an unrecognized script.

Tests

Parser test asserting Uses, With, IsReusableCall, and both lookup helpers against a job-level call. Detector test asserting a reusable lint workflow plus a go build job scores 1.0 at medium confidence.

Full suite, go vet, gofmt clean. No change to plumbline's own snapshot — it has no reusable-workflow calls.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XtNwLDzRYmPrXcYeQypTf9

A job that delegates to a reusable workflow has no `steps:` at all —
`jobs.lint.uses: acme/.github/.github/workflows/lint.yml@main` is the whole
job. rawJob had no Uses field, so the AST saw an empty job and every
workflow signal concluded the work wasn't happening. Splitting lint or
build into a shared org workflow is a normal layout, and it read to
plumbline as an absent gate.

Adds Job.Uses and Job.With, an IsReusableCall helper, and AnyUsesMatches
covering both step and job scope. UsesAction now checks job scope too,
which fixes it for every signal that calls it, not just the L3 gates.

Wires it into l3.build-lint-gate: a reusable workflow whose path names a
recognized linter matches at medium confidence, and one whose path merely
looks lint-shaped falls to the low-confidence name path, same as a step
named "Lint" running an unrecognized script.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XtNwLDzRYmPrXcYeQypTf9
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.

1 participant