Merge pull request #2463 from step-security/ak-upgrading-workflow-ver… #1959
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: Test | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main # to update code coverage | |
permissions: # added using https://github.com/step-security/secure-repo | |
contents: read | |
jobs: | |
test: | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
steps: | |
- uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 | |
with: | |
egress-policy: audit | |
allowed-endpoints: > | |
api.github.com:443 | |
cli.codecov.io:443 | |
codecov.io:443 | |
uploader.codecov.io:443 | |
github.com:443 | |
proxy.golang.org:443 | |
sum.golang.org:443 | |
storage.googleapis.com:443 | |
objects.githubusercontent.com:443 | |
golang.org:443 | |
- name: Checkout | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Set up Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: 1.17 | |
- name: Run coverage | |
run: go test ./... -coverpkg=./... -race -coverprofile=coverage.txt -covermode=atomic | |
env: | |
PAT: ${{ secrets.GITHUB_TOKEN }} | |
- uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |