|
| 1 | +# This file is synced from the `.github` repository, do not modify it directly. |
| 2 | +name: Workflow Syntax |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - master |
| 9 | + paths: |
| 10 | + - '.github/workflows/*.ya?ml' |
| 11 | + pull_request: |
| 12 | + paths: |
| 13 | + - '.github/workflows/*.ya?ml' |
| 14 | + |
| 15 | +defaults: |
| 16 | + run: |
| 17 | + shell: bash -xeuo pipefail {0} |
| 18 | + |
| 19 | +concurrency: |
| 20 | + group: "actionlint-${{ github.ref }}" |
| 21 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 22 | + |
| 23 | +env: |
| 24 | + HOMEBREW_DEVELOPER: 1 |
| 25 | + HOMEBREW_NO_AUTO_UPDATE: 1 |
| 26 | + HOMEBREW_NO_ENV_HINTS: 1 |
| 27 | + |
| 28 | +permissions: {} |
| 29 | + |
| 30 | +jobs: |
| 31 | + workflow_syntax: |
| 32 | + if: github.repository_owner == 'Homebrew' |
| 33 | + runs-on: ubuntu-latest |
| 34 | + steps: |
| 35 | + - name: Set up Homebrew |
| 36 | + id: setup-homebrew |
| 37 | + uses: Homebrew/actions/setup-homebrew@master |
| 38 | + with: |
| 39 | + core: false |
| 40 | + cask: false |
| 41 | + test-bot: false |
| 42 | + |
| 43 | + - name: Install tools |
| 44 | + run: brew install actionlint shellcheck zizmor |
| 45 | + |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + with: |
| 48 | + persist-credentials: false |
| 49 | + |
| 50 | + - run: zizmor --format sarif . >results.sarif |
| 51 | + |
| 52 | + - name: Upload SARIF file |
| 53 | + uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: results.sarif |
| 56 | + path: results.sarif |
| 57 | + |
| 58 | + - name: Set up actionlint |
| 59 | + run: echo "::add-matcher::$(brew --repository)/.github/actionlint-matcher.json" |
| 60 | + |
| 61 | + - run: actionlint |
| 62 | + |
| 63 | + upload_sarif: |
| 64 | + needs: workflow_syntax |
| 65 | + # We want to always upload this even if `actionlint` failed. |
| 66 | + if: always() && !contains(fromJSON('[["cancelled", "skipped"]]'), needs.workflow_syntax.result) |
| 67 | + runs-on: ubuntu-latest |
| 68 | + permissions: |
| 69 | + contents: read |
| 70 | + security-events: write |
| 71 | + steps: |
| 72 | + - name: Download SARIF file |
| 73 | + uses: actions/download-artifact@v4 |
| 74 | + with: |
| 75 | + name: results.sarif |
| 76 | + path: results.sarif |
| 77 | + |
| 78 | + - name: Upload SARIF file |
| 79 | + uses: github/codeql-action/upload-sarif@v3 |
| 80 | + with: |
| 81 | + sarif_file: results.sarif |
| 82 | + category: zizmor |
0 commit comments