Skip to content

Fix

Fix #22

Workflow file for this run

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
)