diff --git a/.github/workflows/auto-fix-lint-format-commit.yml b/.github/workflows/auto-fix-lint-format-commit.yml index 2bdb01168..44ec10034 100644 --- a/.github/workflows/auto-fix-lint-format-commit.yml +++ b/.github/workflows/auto-fix-lint-format-commit.yml @@ -7,11 +7,14 @@ on: jobs: auto-fix: runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.head_ref }} - name: Setup Node.js uses: actions/setup-node@v4 @@ -42,14 +45,13 @@ jobs: git config --local user.name "GitHub Action" git add -A git commit -m "chore: auto-fix linting and formatting issues" - git push + git push origin HEAD:${{ github.head_ref }} - name: Add PR comment uses: actions/github-script@v7 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - const fs = require('fs'); const changes = ${{ steps.git-check.outputs.changes == 'true' }}; const message = changes ? 'Linting and formatting issues were automatically fixed. Please review the changes.'