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