Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Fixes #69

Merged
merged 2 commits into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .github/workflows/shell-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,24 @@ jobs:
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
- name: Format, Commit and Push Changes
run: |
BRANCH_NAME="fix/shfmt"
COMMIT_MSG="Format shell scripts with shfmt"
git diff --exit-code || (

# Check if the branch exists, and switch to it, otherwise create a new branch
if git rev-parse --verify ${BRANCH_NAME}; then
git checkout ${BRANCH_NAME}
git pull origin master
else
git checkout -b ${BRANCH_NAME}
fi

# Format Shell Scripts
find . -type f -name "*.sh" -exec shfmt -w -i 4 {} \;

# Commit and Push
git diff --exit-code || (
COMMIT_MSG="Format shell scripts with shfmt"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
Expand Down
Loading