...
1#!/usr/bin/env bash
2# api-report
3# Generates a report of Go Driver API changes for the current branch.
4set -eux
5
6# Skip the report of it isn't a PR run.
7if [ "$BASE_SHA" == "$HEAD_SHA" ]; then
8 echo "Skipping API Report"
9 exit 0
10fi
11
12# Ensure a clean checkout.
13git checkout -b test-api-report
14git add .
15git commit -m "local changes"
16
17# Ensure gorelease is installed.
18cmd=$(command -v gorelease || true)
19if [ -z $cmd ]; then
20 go install golang.org/x/exp/cmd/gorelease@latest
21fi
22
23# Generate and parse the report.
24gorelease -base=$BASE_SHA > api-report.txt || true
25cat api-report.txt
26go run ./cmd/parse-api-report/main.go
27rm api-report.txt
28
29# Make the PR comment.
30target=$DRIVERS_TOOLS/.evergreen/github_app/create_or_modify_comment.sh
31bash $target -m "## API Change Report" -c "$(pwd)/api-report.md" -h $HEAD_SHA -o "mongodb" -n "mongo-go-driver"
View as plain text