|
| 1 | +# ============================================================ |
| 2 | +# .github/workflows/actionlint.yml (GitHub Actions Lint) |
| 3 | +# ============================================================ |
| 4 | +# WHY-FILE: Central actionlint workflow used by repositories to validate |
| 5 | +# GitHub Actions syntax, expressions, and common workflow mistakes. |
| 6 | +# REQ: This workflow MUST support workflow_call for reuse. |
| 7 | +# REQ: It MUST run on pushes, pull requests, and manual trigger. |
| 8 | +# REQ: It MUST use least privileges. |
| 9 | +# OBS: This workflow validates only and does not modify repository contents. |
| 10 | + |
| 11 | +name: Actionlint |
| 12 | + |
| 13 | +# WHY: Provide a centrally maintained, reusable workflow for validating |
| 14 | +# GitHub Actions across repositories. |
| 15 | +# OBS: Called by thin client workflows in downstream repositories. |
| 16 | + |
| 17 | +on: |
| 18 | + push: |
| 19 | + branches: [main] # WHY: Validate on direct updates to main. |
| 20 | + pull_request: |
| 21 | + branches: [main] # WHY: Validate changes before merge. |
| 22 | + workflow_call: # WHY: Allow reuse from other repositories. |
| 23 | + workflow_dispatch: # WHY: Allow manual triggering. |
| 24 | + |
| 25 | +permissions: # WHY: Use least privileges required. |
| 26 | + contents: read |
| 27 | + |
| 28 | +jobs: |
| 29 | + lint: |
| 30 | + name: GitHub Actions lint |
| 31 | + runs-on: ubuntu-latest # WHY: Linux environment is standard for CI. |
| 32 | + timeout-minutes: 10 # WHY: Prevent hanging jobs; actionlint completes quickly. |
| 33 | + |
| 34 | + steps: |
| 35 | + # ============================================================ |
| 36 | + # ASSEMBLE: Get code |
| 37 | + # ============================================================ |
| 38 | + |
| 39 | + - name: A1) Checkout repository code |
| 40 | + # WHY: Needed to read workflow files from the repository. |
| 41 | + uses: actions/checkout@v6 |
| 42 | + |
| 43 | + # ============================================================ |
| 44 | + # BASIC CHECKS: GitHub Actions workflows |
| 45 | + # ============================================================ |
| 46 | + |
| 47 | + - name: B1) Download actionlint |
| 48 | + shell: bash |
| 49 | + run: | |
| 50 | + bash <(curl -sSfL https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) |
| 51 | +
|
| 52 | + - name: B2) Run actionlint |
| 53 | + shell: bash |
| 54 | + run: | |
| 55 | + ./actionlint -color |
0 commit comments