Repository navigation
66 lines (59 loc) · 2.64 KB
/
Copy pathworkflow-lint.yml
File metadata and controls
66 lines (59 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Workflow Lint
# Static checks for GitHub Actions workflow files: actionlint covers workflow
# schema, expression types, action inputs and script-injection checks, and
# pipes inline `run:` scripts through shellcheck when available.
# See https://github.com/rhysd/actionlint
on:
# No paths filter on pull_request: this workflow backs the required
# "actionlint" status check, and a filtered-out run never reports,
# leaving the check at "Expected" forever. The job itself is seconds.
pull_request:
push:
branches:
- develop
paths:
- '.github/workflows/**'
- '.github/actionlint.yaml'
permissions:
contents: read
concurrency:
group: workflow-lint-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
actionlint:
name: actionlint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Read-only job: nothing pushes, so do not persist credentials.
persist-credentials: false
# Workflow files and local actions, plus the shared actionlint
# script: the step below runs `npm run lint:actionlint`, which lives
# in scripts/validation. Cone mode always includes root files, so
# package.json resolves even though it is not listed here.
sparse-checkout: |
.github
scripts/validation
- name: Download actionlint
env:
ACTIONLINT_VERSION: '1.7.12'
# SHA-256 of actionlint_1.7.12_linux_amd64.tar.gz from the release
# assets (actionlint_1.7.12_checksums.txt). Update both together.
ACTIONLINT_SHA256: '8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8'
run: |
curl -sSfL -o actionlint.tar.gz \
"https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz"
echo "${ACTIONLINT_SHA256} actionlint.tar.gz" | sha256sum -c -
tar xzf actionlint.tar.gz actionlint
./actionlint --version
- name: Run actionlint on active workflows
# Delegates to npm run lint:actionlint, which runs
# scripts/validation/run-actionlint.cjs. That script holds the
# suppression list and reads the file list from .github/workflows, so
# the required CI gate and the local command cannot drift apart and a
# new workflow is checked from the day it lands. It uses the
# ./actionlint downloaded above on Linux x64 when none is on PATH.
run: npm run lint:actionlint