Skip to content

Add GH_TOKEN

Add GH_TOKEN #4

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
unit_tests:
name: "Unit tests"
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.22
- name: Test
run: go test -v -cover -coverprofile=coverage.txt -covermode=count ./...
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt
code_coverage:
name: "Code coverage report"
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
needs: unit_tests
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Download code coverage results from source branch
run: 'echo "TODO: Download code coverage results from source branch"'
- name: Download code coverage results
uses: actions/download-artifact@v4
with:
name: code-coverage
path: source-coverage.txt
- name: Compare code coverage results
run: 'echo "## Coverage report" > coverage-comment.md'
- name: Comment on pull request
run: gh pr comment ${{ github.event.number }} --body-file coverage-comment.md