name: Format Python code with Ruff, and Bash code with Shfmt on: push: branches: [ "dev" ] jobs: format: runs-on: ubuntu-latest permissions: # Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. contents: write steps: - uses: actions/checkout@v4 - name: Run Shfmt on Bash files uses: collin-miller/shfmt-action@v1 with: # -i=4 # indent # -kp # keep column alignment paddings # -sr # redirect operators will be followed by a space # -bn # binary ops like && and | may start a line # -ci # switch cases will be indented # -w # write to file instead of stdout args: -i=4 -kp -sr -bn -ci -w hooks/ helpers/helpers helpers/helpers.v1.d/ helpers/helpers.v2.1.d/ continue-on-error: true - name: Run Ruff on Python files for import sorting # See https://docs.astral.sh/ruff/formatter/#sorting-imports uses: astral-sh/ruff-action@v3 with: args: "check --select I --fix" - name: Run Ruff on Python files uses: astral-sh/ruff-action@v3 with: args: "format" - uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: ":art: ${{ github.workflow }}"