rhysd / actionlint

:octocat: Static checker for GitHub Actions workflow files
https://rhysd.github.io/actionlint/
MIT License
2.49k stars 149 forks source link

feat: Add `workflow_run.workflows` references check #400

Open gmazzo opened 3 months ago

gmazzo commented 3 months ago

Implements #83 by introducing a new workflow_run rule to check the existence of referenced workflows at that trigger.

This rule is a bit different than others, it will be a singleton instance for the check run (instead of one per file), to allow collecting workflow names from the whole suite.

Because of that, it can only apply when calling LintFiles (nil for other usages of the linter). It validates that any name reference on workflow_run.workflow exists in another workflow of the same set.

on:
  workflow_run:
    types: [completed]
    workflows:
      - build
      - test # ERROR: This workflow does not exist, its name is `Tests`

image

This is my first experience working with Go, feel free to suggest any change regarding code style or best practices.

gmazzo commented 2 months ago

Hi @rhysd, I see there is activity in this repo. Any chance to get this one reviewed? We are currently using a forked internal version of your tool.

Great work by the way!