diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 1b9128afb..153fe1d9b 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -12,15 +12,15 @@ jobs: pre-commit: runs-on: ubuntu-latest timeout-minutes: 10 + env: + REPO_SCOPED_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }} steps: - name: Check out the repo uses: actions/checkout@v4 with: fetch-depth: 0 - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.ref }} - token: ${{ secrets.REPO_SCOPED_TOKEN || github.token }} + token: ${{ env.REPO_SCOPED_TOKEN || github.token }} - name: Setup environment uses: ./.github/actions/setup-environment @@ -38,8 +38,7 @@ jobs: shell: bash - uses: stefanzweifel/git-auto-commit-action@v5 - # Always commit changes even if pre-commit failed - if: always() && github.event_name == 'pull_request' + if: ${{ always() && env.REPO_SCOPED_TOKEN && github.event_name == 'pull_request' }} with: commit_message: "Automated pre-commit update" push_options: "--no-verify"