|
8 | 8 |
|
9 | 9 | jobs: |
10 | 10 | pre-commit-checks: |
11 | | - name: Pre-commit Checks (JDK ${{ matrix.java-version }}) |
| 11 | + name: Pre-commit Checks |
12 | 12 | runs-on: ubuntu-latest |
13 | 13 |
|
14 | 14 | permissions: |
|
31 | 31 |
|
32 | 32 | - name: Setup Gradle |
33 | 33 | uses: gradle/actions/setup-gradle@v5 |
34 | | - with: |
35 | | - build-scan-publish: true |
36 | | - build-scan-terms-of-use-url: "https://gradle.com/help/legal-terms-of-use" |
37 | | - build-scan-terms-of-use-agree: "yes" |
38 | | - cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' }} |
39 | | - |
40 | | - - name: Cache pre-commit environments |
41 | | - uses: actions/cache@v4 |
42 | | - with: |
43 | | - path: | |
44 | | - ~/.cache/pre-commit |
45 | | - ~/.local/share/pre-commit |
46 | | - key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-${{ runner.os }} |
47 | | - restore-keys: | |
48 | | - pre-commit-${{ runner.os }} |
49 | 34 |
|
50 | 35 | - name: Set up Python |
51 | 36 | uses: actions/setup-python@v5 |
|
55 | 40 | - name: Install pre-commit |
56 | 41 | run: pip install pre-commit |
57 | 42 |
|
58 | | - - name: Make gradlew executable |
59 | | - run: chmod +x ./gradlew |
60 | | - |
61 | 43 | - name: Run pre-commit hooks |
62 | | - id: precommit |
63 | | - continue-on-error: false |
64 | 44 | run: | |
65 | | - set -e # Exit immediately on error |
66 | | - echo "Running pre-commit checks..." |
67 | | - pre-commit run --all-files --show-diff-on-failure --color=always --verbose |
68 | | -
|
69 | | - - name: Comment on PR with results |
70 | | - if: github.event_name == 'pull_request' && always() |
71 | | - uses: actions/github-script@v7 |
72 | | - with: |
73 | | - script: | |
74 | | - const result = '${{ steps.precommit.outcome }}'; |
75 | | - if (result === 'failure') { |
76 | | - github.rest.issues.createComment({ |
77 | | - issue_number: context.issue.number, |
78 | | - owner: context.repo.owner, |
79 | | - repo: context.repo.repo, |
80 | | - body: `❌ Pre-commit checks failed for JDK 25. Please check the workflow run for details.` |
81 | | - }); |
82 | | - } else if (result === 'success') { |
83 | | - github.rest.issues.createComment({ |
84 | | - issue_number: context.issue.number, |
85 | | - owner: context.repo.owner, |
86 | | - repo: context.repo.repo, |
87 | | - body: `✅ Pre-commit checks passed!` |
88 | | - }); |
89 | | - } |
| 45 | + chmod +x ./gradlew |
| 46 | + pre-commit run --all-files --show-diff-on-failure --color always |
0 commit comments