forked from KuduApps/GoSample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathworkflow.yml
More file actions
45 lines (40 loc) · 1.11 KB
/
workflow.yml
File metadata and controls
45 lines (40 loc) · 1.11 KB
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
name: GoLint
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.22'
- name: Run linter
run: |
go get -u golang.org/x/lint/golint
golint ./...
- name: Review code
if: always()
uses: actions/github-script@0.9.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const outputs = [];
const lintOutput = require('child_process')
.execSync('golint ./...', { encoding: 'utf8' });
outputs.push(lintOutput);
if (outputs.length) {
console.log('Found linting issues:');
outputs.forEach(output => console.log(output));
throw new Error('Linting issues were found. Please fix them before merging.');
} else {
console.log('No linting issues found.');
}