From af1361998a5035216fb075bf6d085b63fd679e4b Mon Sep 17 00:00:00 2001 From: taroj1205 Date: Sun, 25 May 2025 17:02:08 +1200 Subject: [PATCH 1/4] feat(biome): add a workflow to create pull request to automatically fix biome check issue --- .github/workflows/biome-autofix.yml | 57 +++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/biome-autofix.yml diff --git a/.github/workflows/biome-autofix.yml b/.github/workflows/biome-autofix.yml new file mode 100644 index 0000000..14fce25 --- /dev/null +++ b/.github/workflows/biome-autofix.yml @@ -0,0 +1,57 @@ +name: Biome Auto-fix on Master + +on: + push: + branches: + - master + +jobs: + biome-autofix: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install dependencies + run: npm ci + + - name: Run Biome check + id: biome_check + run: | + npx biome check . + continue-on-error: true + + - name: Run Biome auto-fix if needed + if: ${{ steps.biome_check.outcome == 'failure' }} + run: npx biome check --write . + + - name: Commit and push fixes + if: ${{ steps.biome_check.outcome == 'failure' }} + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git checkout -B biome-fix/master + git add . + git commit -m "chore(biome): auto-fix style issues [bot]" || echo "No changes to commit" + git push -u origin biome-fix/master --force + + - name: Create or update PR with fixes + if: ${{ steps.biome_check.outcome == 'failure' }} + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: biome-fix/master + base: master + title: "chore(biome): auto-fix style issues" + body: | + This PR was automatically created by a workflow to fix Biome style issues on master. + commit-message: "chore(biome): auto-fix style issues [bot]" + author: "github-actions[bot] " \ No newline at end of file From 18aedf3281ebef3d4ad4c31126b53b98c23633e1 Mon Sep 17 00:00:00 2001 From: taroj1205 Date: Sun, 25 May 2025 17:04:39 +1200 Subject: [PATCH 2/4] chore(biome): ignore markdown and gitignore files in autofix workflow --- .github/workflows/biome-autofix.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/biome-autofix.yml b/.github/workflows/biome-autofix.yml index 14fce25..c28b6ff 100644 --- a/.github/workflows/biome-autofix.yml +++ b/.github/workflows/biome-autofix.yml @@ -4,6 +4,9 @@ on: push: branches: - master + paths-ignore: + - '**.md' + - '.gitignore' jobs: biome-autofix: From 1903591705e6d95eac8a9109908b8d2b350b41f8 Mon Sep 17 00:00:00 2001 From: taroj1205 Date: Sun, 25 May 2025 17:05:44 +1200 Subject: [PATCH 3/4] fix(workflow): add missing newline at end of biome-autofix.yml file --- .github/workflows/biome-autofix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/biome-autofix.yml b/.github/workflows/biome-autofix.yml index c28b6ff..a21b446 100644 --- a/.github/workflows/biome-autofix.yml +++ b/.github/workflows/biome-autofix.yml @@ -57,4 +57,4 @@ jobs: body: | This PR was automatically created by a workflow to fix Biome style issues on master. commit-message: "chore(biome): auto-fix style issues [bot]" - author: "github-actions[bot] " \ No newline at end of file + author: "github-actions[bot] " From 14959666f9408b60b78c0c75ee953e45765f3f1d Mon Sep 17 00:00:00 2001 From: taroj1205 Date: Sun, 25 May 2025 17:11:20 +1200 Subject: [PATCH 4/4] chore(workflow): reset working directory to match origin/master in biome-autofix.yml --- .github/workflows/biome-autofix.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/biome-autofix.yml b/.github/workflows/biome-autofix.yml index a21b446..c392468 100644 --- a/.github/workflows/biome-autofix.yml +++ b/.github/workflows/biome-autofix.yml @@ -18,6 +18,12 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Reset working directory to match origin/master + run: | + git fetch origin master + git reset --hard origin/master + git clean -fdx + - name: Setup Node.js uses: actions/setup-node@v4 with: