Skip to content

Commit f05c430

Browse files
committed
Add actionlint workflow to lint GitHub Actions
1 parent cbadad0 commit f05c430

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/actionlint.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Lints the GitHub Actions workflows themselves with actionlint
19+
# (https://github.com/rhysd/actionlint): workflow syntax, expression contexts,
20+
# and embedded shell (via shellcheck). actionlint is run through
21+
# github/super-linter (restricted to the GitHub Actions validator) because the
22+
# ASF org allowed-actions policy permits GitHub-owned actions but not the
23+
# stand-alone actionlint action/image. Only runs when a workflow file changes.
24+
name: Actionlint
25+
26+
on:
27+
push:
28+
paths:
29+
- '.github/workflows/**'
30+
pull_request:
31+
paths:
32+
- '.github/workflows/**'
33+
34+
# cancel superseded runs on the same ref (e.g. rapid pushes to a branch)
35+
concurrency:
36+
group: ${{ github.workflow }}-${{ github.ref }}
37+
cancel-in-progress: true
38+
39+
permissions:
40+
contents: read
41+
42+
jobs:
43+
actionlint:
44+
name: Lint GitHub Actions workflows
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout maven
48+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
49+
with:
50+
persist-credentials: false
51+
52+
# super-linter is GitHub-owned, so it satisfies the ASF allowed-actions
53+
# policy (a stand-alone actionlint action/image is not on the allowlist).
54+
# VALIDATE_GITHUB_ACTIONS restricts it to actionlint only; other linters
55+
# (shellcheck, yaml, ...) can be enabled later via more VALIDATE_* flags.
56+
- name: Lint workflows with actionlint (via super-linter)
57+
uses: github/super-linter/slim@b807e99ddd37e444d189cfd2c2ca1274d8ae8ef1 # v7
58+
env:
59+
VALIDATE_ALL_CODEBASE: true
60+
VALIDATE_GITHUB_ACTIONS: true
61+
DEFAULT_BRANCH: master
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)