Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Not truly useable as a tool for developers of reusable actions #350

Open
douglascamata opened this issue Sep 5, 2023 · 6 comments
Open

Comments

@douglascamata
Copy link

I tried using actionlint in a small reusable Github Action that I develop and I got a lot of false positives (see below).

$ actionlint action.yml 
action.yml:1:1: "on" section is missing in workflow [syntax-check]
  |
1 | name: "Setup Docker on macOS"
  | ^~~~~
action.yml:1:1: "jobs" section is missing in workflow [syntax-check]
  |
1 | name: "Setup Docker on macOS"
  | ^~~~~
action.yml:2:1: unexpected key "description" for "workflow" section. expected one of "concurrency", "defaults", "env", "jobs", "name", "on", "permissions", "run-name" [syntax-check]
  |
2 | description: "Setup Docker on macOS using Colima, Lima-VM, and Homebrew."
  | ^~~~~~~~~~~~
action.yml:3:1: unexpected key "inputs" for "workflow" section. expected one of "concurrency", "defaults", "env", "jobs", "name", "on", "permissions", "run-name" [syntax-check]
  |
3 | inputs:
  | ^~~~~~~
action.yml:8:1: unexpected key "outputs" for "workflow" section. expected one of "concurrency", "defaults", "env", "jobs", "name", "on", "permissions", "run-name" [syntax-check]
  |
8 | outputs:
  | ^~~~~~~~
action.yml:18:1: unexpected key "runs" for "workflow" section. expected one of "concurrency", "defaults", "env", "jobs", "name", "on", "permissions", "run-name" [syntax-check]
   |
18 | runs:
   | ^~~~~

All these missing sections and unexpected keys are completely fine when you are developing a reusable Github Action that gets published in the marketplace. For reference, I ran the tool over this file.

I would love if this tool had a toggle to tell it the action being linted is a reusable one and it could adapt accordingly to such scenario.

Thanks!

@AlexandreDecan
Copy link

AFAIK actionlint is used to lint workflow files, not action files...

@douglascamata
Copy link
Author

Very likely, that's its current state, yes. But why not cover both? 😄

@AlexandreDecan
Copy link

Because linting an Action is different than linting a workflow. The name of the tool is maybe a bit misleading, but its purpose is well defined on the homepage: "actionlint is a static checker for GitHub Actions workflow files."

@douglascamata
Copy link
Author

@AlexandreDecan it's not much different (did I ever say they were the same thing?), besides a few schema items. Anyway, this issue is a suggestion/feature request to the project. A project's purpose might change over time. :)

@AlexandreDecan
Copy link

AlexandreDecan commented Sep 6, 2023

Indeed :-) But remember you started your message with "I got a lot of false positives", my point was it's not surprising to have false positives if the tool is applied on the wrong file :-D

@cmotsn
Copy link

cmotsn commented Oct 27, 2023

This might be a duplicate of #46 ?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants