|
| 1 | +# Generated by Gabo (https://github.com/ashishb/gabo) |
| 2 | +--- |
| 3 | +# Run this locally with act - https://github.com/nektos/act |
| 4 | +# act -j lintGitHubActions |
| 5 | +name: Lint GitHub Actions |
| 6 | + |
| 7 | +on: # yamllint disable-line rule:truthy |
| 8 | + push: |
| 9 | + branches: [master, main] |
| 10 | + paths: |
| 11 | + - ".github/workflows/**.yml" |
| 12 | + - ".github/workflows/**.yaml" |
| 13 | + pull_request: |
| 14 | + branches: [master, main] |
| 15 | + paths: |
| 16 | + - ".github/workflows/**.yml" |
| 17 | + - ".github/workflows/**.yaml" |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 21 | + cancel-in-progress: true |
| 22 | + |
| 23 | +jobs: |
| 24 | + lintGitHubActionsWithActionLint: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 15 |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + persist-credentials: false |
| 33 | + sparse-checkout: | |
| 34 | + .github/workflows |
| 35 | + sparse-checkout-cone-mode: false |
| 36 | + |
| 37 | + - name: Lint GitHub Actions |
| 38 | + uses: reviewdog/action-actionlint@v1 |
| 39 | + |
| 40 | + - name: Check GitHub Actions with 'actionlint' |
| 41 | + # Ref: https://github.com/rhysd/actionlint/blob/main/docs/usage.md#use-actionlint-on-github-actions |
| 42 | + # shellcheck is too noisy and disabled |
| 43 | + run: | |
| 44 | + bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) |
| 45 | + ./actionlint -color -shellcheck= |
| 46 | + shell: bash |
| 47 | + |
| 48 | + |
| 49 | + lintGitHubActionsForSecurity: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + timeout-minutes: 15 |
| 52 | + |
| 53 | + permissions: |
| 54 | + security-events: write |
| 55 | + contents: read |
| 56 | + actions: read |
| 57 | + |
| 58 | + steps: |
| 59 | + - name: Checkout repository |
| 60 | + uses: actions/checkout@v4 |
| 61 | + with: |
| 62 | + persist-credentials: false |
| 63 | + sparse-checkout: | |
| 64 | + .github/workflows |
| 65 | + sparse-checkout-cone-mode: false |
| 66 | + |
| 67 | + - name: Setup Rust |
| 68 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 69 | + |
| 70 | + - name: Install zizmor |
| 71 | + run: cargo install zizmor |
| 72 | + |
| 73 | + - name: Run zizmor on GitHub Actions |
| 74 | + run: zizmor .github/workflows/* |
0 commit comments