deps: bump WillAbides/setup-go-faster from 1.10.1 to 1.14.0 #158
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: "CI" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
checks: | |
name: "Checks" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: WillAbides/setup-go-faster@v1.14.0 | |
with: | |
go-version: "*" | |
- run: "go test -coverprofile=coverage.out -covermode=count ./..." | |
- run: "go vet ./..." | |
- uses: dominikh/staticcheck-action@v1.3.0 | |
with: | |
install-go: false | |
- name: Test Release | |
uses: goreleaser/goreleaser-action@v4 | |
with: | |
distribution: goreleaser | |
version: latest | |
args: build --snapshot --single-target | |
- name: Report Coverage | |
if: github.event_name == 'pull_request' | |
run: | | |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin ${GITHUB_BASE_REF} +refs/notes/coverage:refs/notes/coverage || true | |
git diff -U0 --no-color origin/${GITHUB_BASE_REF} > diff.diff | |
git notes --ref coverage show origin/${GITHUB_BASE_REF} > base_coverage.out || rm base_coverage.out | |
if [[ -f "base_coverage.out" ]]; then | |
coverage_output="$(go run ./cmd/go-patch-cover coverage.out diff.diff base_coverage.out)" | |
else | |
coverage_output="$(go run ./cmd/go-patch-cover coverage.out diff.diff)" | |
fi | |
comment_body=$(cat <<EOF | |
<!-- go-patch-cover/report --> | |
$coverage_output | |
EOF | |
) | |
comments="$(gh api graphql -F subjectId=$PULL_REQUEST_NODE_ID -f query=' | |
query($subjectId: ID!) { | |
node(id: $subjectId) { | |
... on PullRequest { | |
comments(first: 100) { | |
nodes { | |
id | |
isMinimized | |
body | |
} | |
} | |
} | |
} | |
} | |
' --jq '.data.node.comments.nodes | map(select((.body | contains("<!-- go-patch-cover/report -->")) and .isMinimized == false)) | map(.id)[]')" | |
if [[ -n "$comments" ]]; then | |
for val in $comments; do | |
gh api graphql -X POST -F id=$val -F body="$comment_body" -f query=' | |
mutation UpdateComment($id: ID!, $body: String!) { | |
updateIssueComment(input: {id: $id, body: $body}) { | |
clientMutationId | |
} | |
} | |
' | |
done | |
else | |
gh api graphql -X POST -F subjectId=$PULL_REQUEST_NODE_ID -F body="$comment_body" -f query=' | |
mutation AddComment($subjectId: ID!, $body: String!) { | |
addComment(input: {subjectId: $subjectId, body: $body}) { | |
clientMutationId | |
} | |
} | |
' | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OWNER: ${{ github.repository_owner }} | |
REPO: ${{ github.event.repository.name }} | |
PULL_REQUEST_NODE_ID: ${{ github.event.pull_request.node_id }} | |
- name: Save Coverage | |
if: github.event_name == 'push' | |
run: | | |
git fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin ${GITHUB_BASE_REF} +refs/notes/coverage:refs/notes/coverage || true | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git notes --ref coverage add -f -F coverage.out origin/${GITHUB_REF_NAME} | |
git push origin refs/notes/coverage |