jbergstroem / hadolint-gh-action

A hadolint linter for github actions that provides code annotations (and more)
MIT License
12 stars 5 forks source link

Idiomatic way to print hadolint report? #78

Closed SimonSchick closed 1 year ago

SimonSchick commented 2 years ago

I'm trying to simple print all lint failures into the CI log rather than using annotations, mostly for consistency.

But whatever I do I can't seem to get the output to work:

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Docker Lint
        id: docker-lint
        uses: jbergstroem/hadolint-gh-action@v1
        with:
          annotate: false
          error_level: 2
          output_format: tty
          dockerfile: "**/Dockerfile"
      - name: Docker Lint Output
        if: always()
        run: echo ${{ env.OUTPUT }}
        env:
          OUTPUT: ${{ steps.docker-lint.outputs.hadolint_output }} # also tried using outputs directly in echo

Can you let me know if I am using this as designed or if I'm missing something here?

Btw it would be nice if the default behavior (with annotations off and no output format set) for the action to print all errors into the log rather than hiding it.

jbergstroem commented 2 years ago

Thanks for the report. I think that we actuaully wouldn't print it if annotations are disabled. I will look at creating a PR.

jbergstroem commented 2 years ago

@SimonSchick you reckon the "new" summaries would work? I'm personally not a big fan of cluttering with PR comments or similar. I think that can be done regardless of annotation status since the action actually runs twice to maintain different outputs (one with filter).

SimonSchick commented 2 years ago

The summary isn't useful to me since it doesn't include the actual errors, all I'm really looking for is the raw hadolint output in the step output.

jbergstroem commented 2 years ago

@SimonSchick im sorry for slacking - will address this shortly; just revamped a lot of testing first.

Also relevant from your example:

jbergstroem commented 1 year ago

@SimonSchick sorry for closing this without connecting back with you! Would you like to try @main and see how that works for you? Not in a hurry to push a new version of the action, but there have been a lot of changes I can't wait to get a wider audience using.