From 7020a4892a647a658060b6a2259c456a2753d4c1 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 12 Sep 2024 12:37:15 +0200 Subject: [PATCH] ci: autolint code with shfmt in addition to black? --- .github/workflows/autoblack.yml | 26 ----------------------- .github/workflows/autolint.yml | 37 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/autoblack.yml create mode 100644 .github/workflows/autolint.yml diff --git a/.github/workflows/autoblack.yml b/.github/workflows/autoblack.yml deleted file mode 100644 index e22a00a81e..0000000000 --- a/.github/workflows/autoblack.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check / auto apply Black - -on: - push: - branches: [ "dev" ] - -jobs: - black: - name: Check / auto apply black - 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: Check files using the black formatter - uses: psf/black@stable - id: black - with: - options: "." - continue-on-error: true - - - uses: stefanzweifel/git-auto-commit-action@v5 - with: - commit-message: ":art: Format Python code with Black" diff --git a/.github/workflows/autolint.yml b/.github/workflows/autolint.yml new file mode 100644 index 0000000000..d371166222 --- /dev/null +++ b/.github/workflows/autolint.yml @@ -0,0 +1,37 @@ +name: Check / auto apply Black + +on: + push: + branches: [ "dev" ] + +jobs: + autolint: + name: Check / auto apply black and shfmt + 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 + 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 helpers/helpers helpers/helpers.v*.d/* hooks/* + continue-on-error: true + + - name: Check files using the black formatter + uses: psf/black@stable + with: + options: "." + continue-on-error: true + + - uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit-message: ":art: Format Python code with Black, and Bash code with Shfmt"