-
-
Notifications
You must be signed in to change notification settings - Fork 1
33 lines (33 loc) · 934 Bytes
/
shell-format.yaml
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
name: Shell Format
on:
pull_request:
push:
permissions:
contents: write # Grant write permission only for contents (commit/push)
jobs:
shell-format:
name: Shell Format (shfmt)
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Install shfmt
run: |
sudo apt-get install shfmt -y
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Format Shell Scripts
run: |
find . -type f -name "*.sh" -exec shfmt -w -i 4 {} \;
- name: Commit and Push Changes
run: |
git diff --exit-code || (
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Format shell scripts with shfmt"
git push -f
)