Skip to content

Commit c002f99

Browse files
feat(changelog): emit free review link when changes are found (#103)
* feat(changelog): emit free review link when changes are found Mirrors the breaking action: when oasdiff changelog finds changes, emit a ::notice:: annotation and a $GITHUB_STEP_SUMMARY markdown link pointing at the free review page on oasdiff.com. Wording matches the breaking action ("Review & approve these API changes") because changelog surfaces all severities, and warn/err changes still gate the merge and need approval just like breaking ones. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(changelog): install jq in Docker image The new review-link emission uses jq to read the PR head SHA from GITHUB_EVENT_PATH and to URL-encode path arguments. The breaking and pr-comment Dockerfiles already install it; mirror that here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 05ba4ea commit c002f99

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

changelog/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
FROM tufin/oasdiff:v1.15.0
2+
RUN apk add --no-cache jq
23
ENV PLATFORM github-action
34
COPY entrypoint.sh /entrypoint.sh
45
ENTRYPOINT ["/entrypoint.sh"]

changelog/entrypoint.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ fi
9999

100100
if [ -n "$output" ] && ! echo "$output" | head -n 1 | grep -q "^No "; then
101101
write_output "$output"
102+
# Emit upgrade notice pointing to the free review page
103+
urlencode() { printf '%s' "$1" | jq -sRr @uri; }
104+
base_path=$(echo "$base" | sed 's/.*://')
105+
rev_path=$(echo "$revision" | sed 's/.*://')
106+
owner="${GITHUB_REPOSITORY%%/*}"
107+
repo="${GITHUB_REPOSITORY#*/}"
108+
head_sha=$(jq -r '.pull_request.head.sha // empty' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "")
109+
if [ -z "$head_sha" ]; then head_sha="$GITHUB_SHA"; fi
110+
free_review_url="https://www.oasdiff.com/review?owner=${owner}&repo=${repo}&base_sha=$(urlencode "$GITHUB_BASE_REF")&rev_sha=${head_sha}&base_file=$(urlencode "$base_path")&rev_file=$(urlencode "$rev_path")"
111+
echo "::notice::📋 Review & approve these API changes → ${free_review_url}"
112+
echo "### 📋 [Review & approve these API changes](${free_review_url})" >> "$GITHUB_STEP_SUMMARY"
102113
else
103114
write_output "No changelog changes"
104115
fi

0 commit comments

Comments
 (0)