-
Notifications
You must be signed in to change notification settings - Fork 3
53 lines (53 loc) · 1.45 KB
/
dev-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Lint and Format
on:
pull_request:
push:
branches-ignore:
- master
- release/*
tags-ignore:
- v*
jobs:
lint:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
-
name: Run linting
uses: golangci/golangci-lint-action@v6
with:
only-new-issues: true # Only show new issues for pull requests.
format:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
-
name: Run formatting
run: gofmt -s -w duplocloud cmd/duplo-aws-credential-process
-
name: Check if formatting changed
id: git-check
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >>$GITHUB_OUTPUT
-
name: Commit formatting changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Duplo Github Bot'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "lint: go fmt"
git push