fix: github actions to move code coverage to PR check #117
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Workflow | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
name: checks | |
steps: | |
- name: checkout | |
id: checkout | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: stable | |
cache: true | |
- name: generate proto | |
run: | | |
make proto-generate | |
- name: golint-check | |
run: | | |
make golint-check | |
- name: goimports-check | |
run: | | |
make goimports-check | |
- name: Run Tests | |
run: | | |
make test | |
- name: Go Coverage Badge # Pass the `coverage.out` output to this action | |
uses: tj-actions/coverage-badge-go@v2 | |
with: | |
filename: coverage-summary.out | |
target: Readme.md | |
- name: Check for README Changes | |
uses: tj-actions/verify-changed-files@v17 | |
id: verify-changed-files | |
with: | |
files: Readme.md | |
- name: Commit changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add Readme.md | |
git commit -m "chore: Updated coverage badge." | |
- name: Push changes | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ github.token }} | |
- name: Upload Coverage Report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-report | |
path: coverage-summary.out |