Skip to content

Commit 56dc336

Browse files
committed
ci: add actionlint for GitHub Actions workflow linting
Add actionlint integration to lint GitHub Actions workflows: - Create actionlint.yml workflow to run on push/PR to main - Add actionlint pre-commit hook using v1.7.9 - Update SessionStart.sh to install actionlint in remote environments - Add actionlint binary to .gitignore
1 parent b1289be commit 56dc336

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

.claude/hooks/SessionStart.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ fi
6565

6666
composer install
6767

68+
# Install actionlint for GitHub Actions workflow linting
69+
echo "Checking for actionlint..."
70+
if ! command -v actionlint &> /dev/null && [ ! -f "./actionlint" ]; then
71+
echo "actionlint is not installed. Downloading actionlint..."
72+
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
73+
echo "actionlint installed successfully!"
74+
else
75+
echo "actionlint is already available."
76+
fi
77+
6878
# Install infection for mutation testing
6979
echo "Checking for infection..."
7080
if [ ! -f "infection.phar" ]; then

.github/workflows/actionlint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint GitHub Actions workflows
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
actionlint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Download actionlint
18+
id: get_actionlint
19+
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
20+
shell: bash
21+
- name: Check workflow files
22+
run: ${{ steps.get_actionlint.outputs.executable }} -color
23+
shell: bash

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ infection.phar.asc
1414
*.har
1515
infection*.txt
1616
infection-report.html
17+
actionlint

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ repos:
88
- id: check-added-large-files
99
- id: check-merge-conflict
1010
- id: detect-private-key
11+
- repo: https://github.com/rhysd/actionlint
12+
rev: v1.7.9
13+
hooks:
14+
- id: actionlint
1115
- repo: https://github.com/compilerla/conventional-pre-commit
1216
rev: v3.0.0
1317
hooks:

0 commit comments

Comments
 (0)