Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Make Actionlint Directly Invokable as an Action Itself #262

Closed
norwd opened this issue Jan 18, 2023 · 7 comments
Closed

Make Actionlint Directly Invokable as an Action Itself #262

norwd opened this issue Jan 18, 2023 · 7 comments

Comments

@norwd
Copy link
Contributor

norwd commented Jan 18, 2023

Currently, there are two ways of running actionlint in a GitHub Action workflow:

  1. Running the download script to install actionlint and execute it from a run: step:
    - name: Check workflow files
      shell: bash
      run: |
        bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
        ./actionlint -color
  2. Running actionlint from a docker container
    - name: Check workflow files
      uses: docker://rhysd/actionlint:latest
      with:
        args: -color

Both of these two options have some drawbacks. Option 1 requires either always running the download script from the main branch (which may be unstable), or specifying a stable tag (which needs to be manually updated when new versions are released as Dependabot won't suggest updates). Option 2 has the benefit of being tied to a stable version, e.g. docker://rhysd/actionlint:v<TAG>, however, it can only be configured by passing in the args: property as a monolithic string, instead of separate inputs with clear defaults and descriptions.

One solution would be to add a action.yml file to the root that defines inputs: and executes actionlint internally. This could be done as a composite action (as was proposed in #257) or as a dockerized wrapper (which would forgo the need to run the download script). Essentially both of these would be wrapping up one or the other of the existing methods to run actionlint from a workflow. The key benefits here are clearly defined inputs and enabling Dependabot updates.

The possible downsides to adding an action.yml file, as pointed out by @rhysd in #257, is that this adds maintenance costs and is identical to just running one of the two existing methods.

Honestly I'm not seeing much difference between running the download script then executing the downloaded binary with run: and running the dedicated action with uses: though making a new action increases maintenance cost.

However, I believe that having a first party action would still add value. In addition to the aforementioned maintenance improvements to end users by enabling Dependabot and distinct inputs:, this would also add actionlint to the GitHub actions marketplace.

@Bertg
Copy link

Bertg commented Jan 31, 2023

I'm also 👍 for this

  • It adds discoverability for the entire project itself
  • I just like the feel of a package that could validate if it is used correctly :)

It just makes live easier. I've been using it locally for a while, and now want to introduce it to the dev workflow. I was looking for an action of this linter, and couldn't find it. Nor was there any documentation on how to do it. This ticket was the first usable result.

I believe the project should at least describe on how to use itself as a part of a GitHub workflow.

Alternatively, would the project reference an other repo that maintains just the action?

@jthegedus
Copy link

I believe the project should at least describe on how to use itself as a part of a GitHub workflow.

There is a whole section in the docs for this - https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions

It is not directly in the README, but the README does link to USAGE under the DOCS section.

@norwd
Copy link
Contributor Author

norwd commented Jan 31, 2023

I believe the project should at least describe on how to use itself as a part of a GitHub workflow.

There is a whole section in the docs for this - https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions

It is not directly in the README, but the README does link to USAGE under the DOCS section.

I believe there is still a discoverability issue, as I only found those docs after creating my fork and experimenting with a root action.yml file. More importantly, those docs are rather technical and assume that the reader knows a lot about how to roll their own GitHub actions, not just use workflows. If coupling the official action to the main repo is undesirable, perhaps a separate repo with just the action.yml file could be used as @Bertg suggested? This would allow for more simple and targeted documentation in a more accessible place (i.e. the README) and refer to the existing docs for advanced usage.

@kdeldycke
Copy link

kdeldycke commented Feb 25, 2023

Not only will it improve discoverability, but it will allow for pinning the version of both actionlint's action and actionlint binary. And at the same time letting dependabot keep track of upgrades and changelog.

@szepeviktor
Copy link

szepeviktor commented Jul 22, 2023

Some guys couldn't sit quietly at home and publish unofficial actionlint actions on GitHub Marketplace.
https://github.com/marketplace?type=&verification=&query=actionlint

@jbergstroem
Copy link
Contributor

@norwd
Copy link
Contributor Author

norwd commented Nov 18, 2024

I completely forgot about this thread, but if there is still interest, I've created a pull request that implements this. I've been running this fork for almost a year with no problems so it should be safe, again, assuming that there is still anyone else that prefers this method over just using the docker image.

@norwd norwd closed this as not planned Won't fix, can't repro, duplicate, stale Nov 22, 2024
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 a pull request may close this issue.

6 participants