ci: update workflows (#3)

* Update ci.yml
* Delete auto-fix.yml
This commit is contained in:
Oskar 2021-10-21 23:09:46 +02:00 committed by GitHub
parent 857ddb66b0
commit b6fc96d90a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 26 deletions

View File

@ -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 }}

View File

@ -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 ./...