mirror of
https://github.com/MedzikUser/go-utils.git
synced 2024-08-15 03:26:56 +00:00
parent
857ddb66b0
commit
b6fc96d90a
2 changed files with 29 additions and 26 deletions
|
@ -1,18 +1,21 @@
|
|||
name: auto fix
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
- main
|
||||
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
auto-fix:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Repo clone (go mod tidy / gofmt)
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
|
@ -21,27 +24,46 @@ jobs:
|
|||
go-version: 1.17
|
||||
|
||||
- name: Setup Git
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
|
||||
- name: tidy
|
||||
- name: Tidy
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
go mod tidy
|
||||
git add .
|
||||
git diff-index --quiet HEAD || git commit -m "go mod tidy"
|
||||
|
||||
- name: gofmt
|
||||
- name: GoFmt
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
go fmt ./...
|
||||
git add .
|
||||
git diff-index --quiet HEAD || git commit -m "gofmt"
|
||||
|
||||
- name: Pull changes
|
||||
if: github.event_name != 'pull_request'
|
||||
run: git pull -r
|
||||
|
||||
- name: Push changes
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: ${{ github.ref }}
|
||||
|
||||
- name: Repo clone (test)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Semantic Release
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: go-semantic-release/action@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
|
@ -1,19 +0,0 @@
|
|||
name: test
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.16
|
||||
|
||||
- name: Test
|
||||
run: go test -v ./...
|
Loading…
Reference in a new issue