Merge pull request #111 from janpfeifer/script #125
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: "Tests" # The name of the workflow that will appear on Github | |
permissions: | |
# read|write|none | |
actions: read | |
checks: read | |
contents: write | |
deployments: read | |
# id-token: read --> doesn't work | |
issues: read | |
discussions: read | |
packages: read | |
pages: read | |
pull-requests: write | |
repository-projects: read | |
security-events: read | |
statuses: read | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: "1.20.x" | |
- name: Build | |
run: go install | |
- name: Test | |
run: go test --short ./... | |
- name: Go Coverage Badge | |
uses: tj-actions/coverage-badge-go@v2 | |
with: | |
green: 80 | |
filename: docs/coverage.txt # Manually generated. | |
- uses: stefanzweifel/git-auto-commit-action@v4 | |
id: auto-commit-action | |
with: | |
commit_message: Apply Code Coverage Badge | |
skip_fetch: true | |
skip_checkout: true | |
file_pattern: ./README.md | |
- name: Push Changes | |
if: steps.auto-commit-action.outputs.changes_detected == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ github.token }} | |
branch: ${{ github.ref }} |