Skip to content

Commit 44a9cf8

Browse files
ci(GitHub): auto-commit changes from jobs
* Added stefanzweifel/git-auto-commit-action@v6.0.1 to each job. * Further added comment steps explaining the auto-commit. Closes #8 Signed-off-by: Stefan Zimmermann <user@zimmermann.co>
1 parent 1d9ec21 commit 44a9cf8

File tree

2 files changed

+44
-5
lines changed

2 files changed

+44
-5
lines changed

.github/workflows/linting.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ on:
33
push:
44
pull_request:
55

6+
permissions:
7+
contents: write
8+
pull-requests: write
9+
610
jobs:
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,44 @@ 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+
49+
- name: Comment on PR about the auto-commit
50+
if: github.event_name == 'pull_request' && steps.auto_commit.outputs.changes_detected == 'true'
51+
uses: actions/github-script@v8
52+
with:
53+
script: |
54+
const repositoryUrl = '${{ github.server_url }}/${{ github.repository }}'
55+
56+
github.rest.issues.createComment({
57+
issue_number: context.issue.number,
58+
owner: context.repo.owner,
59+
repo: context.repo.repo,
60+
body: `
61+
**Auto-fix applied from ${{ github.workflow }}** / \`${{ github.job }}\` job
62+
63+
* Workflow run: ${repositoryUrl}/actions/runs/${{ github.run_id }}
64+
* Fix commit: ${repositoryUrl}/commit/${{ steps.auto_commit.outputs.commit_hash }}
65+
`})

pointer.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ func NotNilPtr[T any](name string, value *T) *T {
4444
lo.Assertf(value != nil, "%s should not be a nil pointer", name)
4545
return value
4646
}
47+
48+
// bla.
49+
func _() {
50+
}

0 commit comments

Comments
 (0)