You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/workflows/build-and-test-pr.yml
+45-7Lines changed: 45 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -36,9 +36,17 @@ jobs:
36
36
check-format:
37
37
name: "Check if code needs formatting"
38
38
runs-on: ubuntu-latest
39
+
permissions:
40
+
# Give the default GITHUB_TOKEN write permission to commit and push the
41
+
# added or changed files to the repository.
42
+
contents: write
39
43
steps:
40
44
- name: "Checkout"
41
45
uses: actions/checkout@v4
46
+
# Checkout the PR branch at the fork repository for git-auto-commit-action, see details at https://github.com/stefanzweifel/git-auto-commit-action/issues/211
cat mvn.log | grep "ERROR" | sed 's/Check if code needs formatting Check if code aligns with code style [0-9A-Z:.-]\+//' | sed 's/\[ERROR] //' | head -n -11 >> $GITHUB_STEP_SUMMARY
66
74
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
67
-
echo "Please run \`mvn spotless:apply\` to fix the formatting issues." >> $GITHUB_STEP_SUMMARY
68
-
- name: "Fail if code needs formatting"
75
+
- name: "Fix code formatting issues by using spotless:apply"
76
+
id: apply
77
+
if: ${{ steps.check.outcome == 'failure' }}
78
+
run: mvn --log-file spotless.log spotless:apply
79
+
continue-on-error: true
80
+
- name: "Upload spotless apply result"
69
81
if: ${{ steps.check.outcome == 'failure' }}
70
-
uses: actions/github-script@v7.0.1
82
+
uses: actions/upload-artifact@v4
71
83
with:
72
-
github-token: ${{ secrets.GITHUB_TOKEN }}
73
-
script: |
74
-
core.setFailed("Formatting issues found! \nRun \`mvn spotless:apply\` to fix.")
75
-
84
+
name: spotless-result
85
+
path: spotless.log
86
+
- name: "Generate Summary for successful spotless:apply"
0 commit comments