This repository has been archived by the owner on Apr 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (71 loc) · 2.16 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: check go format
on:
push:
branches: [ master ]
paths:
- '**.go'
- '**/go.mod'
- '**/gofmt.yml'
pull_request_target:
branches: [ master ]
paths:
- '**.go'
- '**/go.mod'
jobs:
gofmt:
runs-on: ${{ matrix.os }}
strategy:
matrix:
go-version: [1.15]
os: [ubuntu-latest]
name: check go format
defaults:
run:
shell: bash
steps:
- name: setup go ${{ matrix.go-version }}
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}
- name: "get golang version"
run: echo "::set-env name=golang-version::$(go version)"
- uses: actions/[email protected]
with:
path: ~/go
key: ${{ runner.os }}-go-${{ env.golang-version }}
- name: installing golines
run: go get -u github.com/segmentio/golines
- uses: actions/[email protected]
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
- name: running golines
run: golines --max-len=120 --reformat-tags --write-output .
- name: creating pull request
if: ${{ github.head_ref == '' }}
uses: peter-evans/[email protected]
with:
commit-message: 'style(format): reformat with golines'
title: 'style(format): reformat golang code'
body: |
This pull requests deploys updates the code style using [golines](https://github.com/segmentio/golines).
labels: |
style
chore
branch: gofmt
- name: committing changed files
id: committed
if: ${{ github.head_ref != '' }}
uses: stefanzweifel/[email protected]
with:
commit_message: 'style(format): reformat with golines'
branch: ${{ github.head_ref }}
file_pattern: '*.go'
- uses: christianvuerings/[email protected]
if: ${{ steps.committed.outputs.changes_detected == 'true' }}
with:
labels: |
style
env:
GITHUB_TOKEN: ${{ secrets.PAT }}