reviewdog / action-actionlint

run actionlint with reviewdog
MIT License
76 stars 13 forks source link

issues using `actionlint_flags` with the `-ignore` flag? #80

Open pcassaretto-cmc opened 2 years ago

pcassaretto-cmc commented 2 years ago

With the following

  with:
    actionlint_flags: -ignore 'a pattern' 

actionlint seems to run without producing any findings whatsoever but reports no errors. I noticed in the logs

"/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/repo/repo":"/github/workspace" ghcr.io/reviewdog/action-actionlint:v1.28.0
could not read "pattern'": open pattern': no such file or directory
2022/08/26 15:13:25 [actionlint] reported: https://github.com/org/repo/runs/_id_ (conclusion=success)

so it appears to try and open a file with the name of the last word in the pattern to be ignored. I have tried different approaches surrounding the flag value in different quotes to no avail?

What am I doing wrong?

shogo82148 commented 2 years ago

Can we have whole contents of your .github/workflow/*.yaml?

shichanson commented 2 years ago

I also encountered this problem. Don't know how to solve this problem.

name: "test"

on:
  pull_request:
    branches:
      - master
    paths:
      - ".github/workflows/**"

jobs:
  actionlint:
    runs-on: ["self-hosted"]
    steps:
      - uses: actions/checkout@v3
      - uses: reviewdog/action-actionlint@v1
        with:
          actionlint_flags: -ignore 'label ".+" is unknown' -ignore '".+" is potentially untrusted'
          reporter: github-pr-review
pcassaretto-cmc commented 2 years ago

The workflow @shichanson posted is a great example. I think this issue actually breaks actionlint checking the workflow itself, as no errors in the workflow are reported whatsoever if flags are specified that would only ignore a subset of the errors

shichanson commented 2 years ago

@pcassaretto-cmc Don't say how I use it, there is no doubt that you are a bug. My usage scenario is that I don't want to check my runner label because I have a lot of runners. My github is deployed privately.

sammcj commented 1 year ago

My workaround for this problem is to generate a config file on the fly before the check is run:

      - uses: actions/checkout@v3
      - name: build actionlint config for runner labels
        shell: bash
        run: |
          cat > .github/actionlint.yaml<< EOF
          self-hosted-runner:
            # Labels of self-hosted runner in array of string
            labels:
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
              - aws-redacted-1233456790
          EOF
      - uses: reviewdog/action-actionlint@v1
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          SHELLCHECK_OPTS="-e SC2086 -e SC2129 -e SC1091 -e SC2050 -e SC2194 -e SC2154 -e SC2157"
        with:
          actionlint_flags: -config-file '.github/actionlint.yaml'
          fail_on_error: true
          level: error
          reporter: github-pr-review
          filter_mode: file