-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (51 loc) · 1.87 KB
/
check.yaml
File metadata and controls
60 lines (51 loc) · 1.87 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
name: check
on:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.sha || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup mise
uses: jdx/mise-action@v3
- name: Find bash scripts
id: find-bash
run: |
bash_files=""
# .sh files with bash shebangs
for f in $(find . -name '*.sh' -not -path './.git/*' -not -path './node_modules/*'); do
shebang=$(head -1 "$f")
if echo "$shebang" | grep -qE '(bash|^#!/bin/sh)'; then
bash_files="$bash_files $f"
fi
done
# bin/ scripts without .sh extension
for f in $(find ./bin -maxdepth 1 -type f -not -name '*.sh' -not -path './.git/*'); do
shebang=$(head -1 "$f")
if echo "$shebang" | grep -qE '(bash|^#!/bin/sh)'; then
bash_files="$bash_files $f"
fi
done
echo "files=$bash_files" >> "$GITHUB_OUTPUT"
echo "Found bash files:$bash_files"
- name: ShellCheck
if: steps.find-bash.outputs.files != ''
run: |
bash_files="${{ steps.find-bash.outputs.files }}"
echo "Running ShellCheck on:$bash_files"
shellcheck $bash_files
- name: shfmt check
if: steps.find-bash.outputs.files != ''
run: |
bash_files="${{ steps.find-bash.outputs.files }}"
echo "Running shfmt on:$bash_files"
# -d shows diff; indent settings sourced from .editorconfig
shfmt -d $bash_files
- name: EditorConfig check
uses: editorconfig-checker/action-editorconfig-checker@main
- name: Run editorconfig-checker
run: editorconfig-checker