diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml index 93bc636..50f5507 100644 --- a/.github/workflows/pr-checks.yaml +++ b/.github/workflows/pr-checks.yaml @@ -10,8 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} - name: Set up Node.js uses: actions/setup-node@v3 @@ -32,3 +34,16 @@ jobs: - name: Build run: npm run build + + - name: Auto-fix ESLint Issues + run: npx eslint . --fix + + - name: Commit changes if any + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git diff --quiet || git commit -m "ESLint auto-fix applied by GitHub Actions" || exit 0 + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication \ No newline at end of file