Dependabot auto-merge: Fix step ID (#18) #143
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: Go | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
permissions: {} | |
jobs: | |
golangci-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
only-new-issues: true | |
args: --verbose | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- run: go mod tidy -diff | |
- run: go mod download | |
- run: go mod verify | |
- run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.out -covermode=atomic ./... | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage.out | |
codecov: | |
needs: test | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage | |
- uses: codecov/codecov-action@v5 | |
with: | |
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} | |
generate-diff: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- run: go mod tidy -diff | |
- run: go mod download | |
- run: go mod verify | |
- run: go generate ./... | |
- name: Detect uncommitted changes | |
run: | | |
changes=$(git status --porcelain) | |
if [[ -n "$changes" ]]; then | |
{ | |
echo '## :construction: Uncommitted changes' | |
echo 'Run `$ go generate ./...` to re-generate the files.' | |
echo '```console' | |
echo '$ git status --porcelain' | |
echo "$changes" | |
echo '```' | |
} >> "$GITHUB_STEP_SUMMARY" | |
echo "::group::Uncommitted changes" | |
echo "$changes" | |
echo "::endgroup::" | |
exit 1 | |
fi |