Skip to content

ci: add actionlint - #5385

Open
kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:add-actionlint
Open

ci: add actionlint#5385
kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:add-actionlint

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

No description provided.

@kolyshkin kolyshkin added area/ci backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 labels Aug 5, 2026
@thaJeztah

Copy link
Copy Markdown
Member

Wondering how this one compares to Zimor (which has proven to be very good overall);

https://github.com/zizmorcore/zizmor
https://github.com/zizmorcore/zizmor-action

cc @crazy-max

@kolyshkin

Copy link
Copy Markdown
Contributor Author

Wondering how this one compares to Zimor (which has proven to be very good overall);

https://github.com/zizmorcore/zizmor https://github.com/zizmorcore/zizmor-action

cc @crazy-max

IMHO actionlint is more about correctness, while zizmor is more about security. Perhaps we can use both?

@kolyshkin

Copy link
Copy Markdown
Contributor Author

Alas actionlint is a bit abandoned with no commits since mid-April, and it lacks last versions of standard actions (and thus it doesn't flag some issues). Opened rhysd/actionlint#718 as a fix.

@thaJeztah

Copy link
Copy Markdown
Member

IMHO actionlint is more about correctness, while zizmor is more about security. Perhaps we can use both?

Maybe, yes. I'm honestly not that familiar with actionlint. We should look where they overlap, and where gaps are (ISTR zizmor also had various checks for correctness, so maybe already covers a bunch).

@kolyshkin

kolyshkin commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

IMHO actionlint is more about correctness, while zizmor is more about security. Perhaps we can use both?

Maybe, yes. I'm honestly not that familiar with actionlint. We should look where they overlap, and where gaps are (ISTR zizmor also had various checks for correctness, so maybe already covers a bunch).

I ran a quick test (with the help of AI): actionlint caught 6 of 7 issues, zizmor only found 1 of 7. NOTE this test is deliberately biased towards broken workflows (rather than their security).

Here's the file:

  name: broken
  on:
    pull_request:
  permissions:
    contents: read
  jobs:
    j:
      runs-on: ubuntu-24.04
      steps:
        - uses: actions/checkout@v7
        - run: echo ${{ github.event.pull_request.title }} # 1
        - run: echo "${{ matrix.nosuch }}" # 2
        - if: github.event_name == 'pull_request' && sucess() # 3
          run: |
            FILES=$(ls)
            echo $FILES # 4
        - uses: actions/setup-go@v7
          with:
            go-versionn: '1.24' # 5
    k:
      needs: nonexistent # 6
      runs-on: ubunut-24.04 # 7
      steps:
        - run: true

Issues:

  1. untrusted github.event.pull_request.title interpolated into run
  2. matrix.nosuch -- no strategy.matrix on this job
  3. sucess() typo -- undefined function
  4. shellcheck SC2086 unquoted $FILES
  5. typo in action parameter (go-versionn).
  6. needs: nonexistent (refers to a missing job)
  7. ubunut-24.04 -- typo

Zizmor only found 1 ("template-injection").

actionlint found all but 5 (and this is being fixed in rhysd/actionlint#718).

I am not against adding zizmor (and will probably do so later), but it serves a very different purpose to that of actionlint.

@kolyshkin

Copy link
Copy Markdown
Contributor Author

I am not against adding zizmor (and will probably do so later)

Done: #5387

@kolyshkin

Copy link
Copy Markdown
Contributor Author

Again, zizmor and actionlint serve entirely different purposes:

  • actionlint is to check GHA validity (and help with any possible issues, for example when a CI job is not being run);
  • zizmor is security-focused and helps to prevent various bad things.

@cyphar

cyphar commented Aug 6, 2026

Copy link
Copy Markdown
Member

I was working on adding actionlint and zizmor to libpathrs and I also found that they have totally different uses and having both is useful -- it is really nice when actionlint finds a typo in a variable substitution without you need to do a full CI run to find it.

Comment thread .github/workflows/actionlint.yml Outdated
Comment on lines +24 to +26
VERSION: 1.7.12
BASEURL: https://github.com/rhysd/actionlint/releases/download
SHA256: c872d6db8c6bf83a8eaa704fc93999f027d55dffbc63b8a6abdccb47df5f4cd4

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't an action we can pin against? If we do it this way dependabot won't be able to bump this for us (FWIW renovate has mechanisms to allow for custom bump rules that would work here but we decided to not switch last time we discussed this IIRC).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a third party action which we can use. Internally it runs a docker image and has a few small issues () but I guess the luxury of being updated by dependabot outweighs the flaws.

Changed to use https://github.com/devops-actions/actionlint

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(those do not prevent from using the action as is, IOW we don't have to wait for a new version with those PRs applied)

This is mostly shellcheck complaining about missing quotes (SC2046
and SC2086). Issues found by actionlint (which runs shellcheck for
all run: statements in GHA workflows.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Debugging GHA yaml is not fun -- usually when there is an issue with a
workflow file, it just doesn't run.

Let's add a separate actionlint job to catch workflow issues.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin

Copy link
Copy Markdown
Contributor Author

@opencontainers/runc-maintainers PTAL (easy to review, CI only, and I have another PR which depending on this one)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ci backport/1.5-todo A PR in main branch which needs to be backported to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants