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

Probable false positive when linting action.yml on the image directive #428

Closed
ferrarimarco opened this issue May 24, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@ferrarimarco
Copy link

Hi, and thanks for working on actionlint! :)

After updating to 1.7.0, actionlint reports what it's likely a false positive.

As part of the test suite of a container-based action, we do the following:

  1. Build the container image. The resulting image is tagged as ghcr.io/super-linter/super-linter:latest
  2. Update the image section of action.yml to point to the container image we just built. The resulting action.yml is similar to the following:
name: 'Super-Linter'
author: 'Super-linter contributors'
description: 'Super-linter is a ready-to-run collection of linters and code analyzers, to help validate your source code.'
runs:
  using: 'docker'
  image: 'ghcr.io/super-linter/super-linter:latest'
  1. Run the action using the container image we just built:
      - name: Test Local Action (debug log)
        uses: ./
        env:
          ...

As part of this test suite, we also run actionlint. It gets confused when looking at the updated action.yml as follows:

.github/workflows/ci.yml:163:15: file "ghcr.io/super-linter/super-linter:latest\\" does not exist in "/github/workspace". it is specified at "image" key in "runs" section in "Super-Linter\\" action [action]
      |
  163 |         uses: ./
      |               ^~
  .github/workflows/ci.yml:163:15: the local file "ghcr.io/super-linter/super-linter:latest" referenced from "image" key must be named "Dockerfile" in "Super-Linter" action. the action is defined at "/github/workspace" [action]
      |
  163 |         uses: ./
      |               ^~
@ferrarimarco ferrarimarco changed the title Probably false positive when linting action.yml on the image directive Probable false positive when linting action.yml on the image directive May 24, 2024
@ferrarimarco
Copy link
Author

Or, maybe we should add docker:// I suppose?

@rhysd
Copy link
Owner

rhysd commented May 25, 2024

Thank you for catching this. I think actionlint is too strict on checking the image property.

Or, maybe we should add docker:// I suppose?

It should fix the error. But if ghcr.io/... is valid on GitHub Actions, actionlint should not cause an error on the value.

@rhysd
Copy link
Owner

rhysd commented May 25, 2024

I searched GitHub: https://github.com/search?q=%22using%3A+%27docker%27%22+language%3AYAML+ghcr.io&type=code&p=1

  • In most cases, docker:// is explicitly specified. I recommend this because removing the scheme is ambiguous
  • actionlint should not complain the missing scheme because it is not a wrong usage. I'll fix this.

@rhysd rhysd closed this as completed in 10e833c May 25, 2024
@rhysd rhysd added the bug Something isn't working label May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants