reviewdog / action-actionlint

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

how to add runner labels #76

Open CvH opened 2 years ago

CvH commented 2 years ago

We are using runner labels and get errors like

[actionlint] reported by reviewdog 🐶
label "scripts" is unknown. available labels are "windows-latest", "windows-2022", "windows-2019", "windows-2016", "ubuntu-latest", "ubuntu-22.04", "ubuntu-20.04", "ubuntu-18.04", "macos-latest", "macos-12", "macos-12.0", "macos-11", "macos-11.0", "macos-10.15", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file [runner-label]

if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file [runner-label]

is there a possibility to pass this option to actionlint?

sammcj commented 2 years ago

Having this issue as well, it looks like reviewdog doesn't provide a way to pass labels in or a config file.

sammcj commented 2 years ago

I've got a pretty gross workaround - but it does work, you can create a temporary config file for the action to use.

Here's an example using a reusable workflow I created:

name: Lint Actions Workflows

# ensure you set secrets to inherit

on:
  workflow_call:

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - 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:
              - my-self-hosted-runner-1
              - my-self-hosted-runner-2
          EOF
      - uses: reviewdog/action-actionlint@v1
        with:
          actionlint_flags: -ignore SC2086 -config-file .github/actionlint.yaml
          fail_on_error: true
          level: error
          reporter: github-pr-review
        env:
          REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
arizz96 commented 2 months ago

Hey there, I found a similar issue these days, I solved by creating the .github/actionlint.yaml myself, instead of letting the CI step doing it. The doc is available here. Hope this helps 💪