33 push :
44 pull_request :
55
6+ permissions :
7+ contents : write
8+ pull-requests : write
9+
610jobs :
711 lint :
12+ name : Lint w/ golangci-lint
813 runs-on : ubuntu-latest
9- permissions :
10- contents : write
11-
1214 steps :
1315 - uses : actions/checkout@v5
1416 with :
@@ -20,11 +22,57 @@ jobs:
2022 go-version : 1.25.1
2123
2224 - name : Run go mod tidy
23- run : go mod tidy
25+ run : |
26+ go mod tidy
2427
2528 - name : Install & run golangci-lint
2629 uses : golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
2730 with :
2831 version : latest
2932 install-mode : " goinstall"
30- args : --fix
33+
34+ args : --enable godot --fix
35+
36+ - name : Auto-commit lint fixes
37+ id : auto_commit
38+ if : github.event_name == 'pull_request'
39+ # uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
40+ # with:
41+ # status_options: --untracked-files=no
42+ #
43+ # commit_message: Auto-fix from ${{ github.workflow }} / ${{ github.job }} job
44+ # commit_user_name: Stefan Zimmermann
45+ # commit_user_email: user@zimmermann.co
46+ # commit_author: Stefan Zimmermann <user@zimmermann.co>
47+ # commit_options: --signoff
48+ run : |
49+ if [[ -n "$(git status --porcelain)" ]]; then
50+ git config user.name "Stefan Zimmermann"
51+ git config user.email "user@zimmermann.co"
52+
53+ git commit --all --signoff --message "Auto-fix from ${{ github.workflow }} / ${{ github.job }} job"
54+ git push origin HEAD:${{ github.head_ref }}
55+
56+ echo "changes_detected=true" >> $GITHUB_OUTPUT
57+ echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
58+ else
59+ echo "changes_detected=false" >> $GITHUB_OUTPUT
60+ fi
61+
62+ - name : Comment on PR about the auto-commit
63+ if : github.event_name == 'pull_request' && steps.auto_commit.outputs.changes_detected == 'true'
64+ uses : actions/github-script@v8
65+ with :
66+ script : |
67+ const repositoryUrl = '${{ github.server_url }}/${{ github.repository }}'
68+
69+ github.rest.issues.createComment({
70+ issue_number: context.issue.number,
71+ owner: context.repo.owner,
72+ repo: context.repo.repo,
73+ body: `
74+ **Auto-fix applied from ${{ github.workflow }}** / \`${{ github.job }}\` job
75+
76+ * Workflow run: ${repositoryUrl}/actions/runs/${{ github.run_id }}
77+ * Fix commit: ${repositoryUrl}/commit/${{ steps.auto_commit.outputs.commit_hash }}
78+ `})
0 commit comments