-
Notifications
You must be signed in to change notification settings - Fork 15
37 lines (31 loc) · 992 Bytes
/
gofmt.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
name: GoFmt
on:
pull_request_target:
branches: [ master ]
jobs:
gofmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
token: ${{ secrets.GH_PAT }}
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.19'
- name: gofmt
run: |
if [ "$(gofmt -s -l -w . | wc -l)" -gt 0 ]; then
git config --local user.name 'github-actions[bot]'
git config --local user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add --all
git commit -m "gofmt"
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
branch: ${{ github.head_ref }}
github_token: ${{ secrets.GH_PAT }}