diff --git a/.github/workflows/fix.yaml b/.github/workflows/fix.yaml deleted file mode 100644 index 438cab16..00000000 --- a/.github/workflows/fix.yaml +++ /dev/null @@ -1,41 +0,0 @@ -name: Fix - -on: - pull_request: - branches: main - -jobs: - fix: - runs-on: ubuntu-latest - - permissions: - contents: write - - if: github.actor != 'github-actions[bot]' - - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - uses: pnpm/action-setup@v4 - with: - version: latest - - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: pnpm - - run: pnpm install - - run: pnpm run lint:fix - - run: git add . - - - uses: qoomon/actions--create-commit@v1 - id: actions--create-commit - with: - message: | - 🎨 pnpm run lint:fix - - [dependabot skip] - skip-empty: true - - - if: ${{ steps.actions--create-commit.outputs.commit }} - run: git push diff --git a/.github/workflows/node.js.yaml b/.github/workflows/node.js.yaml index d58bbaf6..d7897810 100644 --- a/.github/workflows/node.js.yaml +++ b/.github/workflows/node.js.yaml @@ -1,10 +1,15 @@ name: Node.js CI on: - push: - branches: main + merge_group: + branches: + - main pull_request: - branches: main + branches: + - main + push: + branches: + - main jobs: test: @@ -22,3 +27,65 @@ jobs: - run: pnpm install --frozen-lockfile --strict-peer-dependencies - run: pnpm run build - run: pnpm run lint + + fix: + runs-on: ubuntu-latest + + permissions: + contents: write + + needs: + - test + + if: failure() && github.event_name != 'merge_group' && github.actor != 'github-actions[bot]' && github.actor != 'nektos/act' + + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - uses: pnpm/action-setup@v4 + with: + version: latest + - uses: actions/setup-node@v4 + with: + cache: pnpm + node-version: 22 + + - run: | + pnpm install --fix-lockfile --no-frozen-lockfile + git add . + - id: commit-lockfile + uses: qoomon/actions--create-commit@v1 + with: + message: | + 📌 pnpm install --fix-lockfile + + [dependabot skip] + skip-empty: true + + - run: | + pnpm run format + git add . + - id: commit-format + uses: qoomon/actions--create-commit@v1 + with: + message: | + 🎨 pnpm run format + + [dependabot skip] + skip-empty: true + + - run: | + pnpm run lint:fix + git add . + - id: commit-lint + uses: qoomon/actions--create-commit@v1 + with: + message: | + 🚨 pnpm run lint:fix + + [dependabot skip] + skip-empty: true + + - if: steps.commit-lockfile.outputs.commit || steps.commit-format.outputs.commit || steps.commit-lint.outputs.commit + run: git push diff --git a/package.json b/package.json index 42ad5773..1a3689fe 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "deploy": "docusaurus deploy", "clear": "docusaurus clear", "serve": "docusaurus serve", + "format": "prettier --write .", "lint": "markdownlint-cli2 \"**/*.md\" && prettier --check .", "lint:fix": "markdownlint-cli2 \"**/*.md\" --fix; prettier --list-different --write .", "write-translations": "docusaurus write-translations",