Some more fix #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
) |