Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion breaking/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,15 @@ if [ -n "$breaking_changes" ] && ! echo "$breaking_changes" | head -n 1 | grep -
repo="${GITHUB_REPOSITORY#*/}"
head_sha=$(jq -r '.pull_request.head.sha // empty' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "")
if [ -z "$head_sha" ]; then head_sha="$GITHUB_SHA"; fi
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")"
# base_sha must be an immutable commit SHA, not the branch name. Using
# $GITHUB_BASE_REF (the branch) makes the URL decay whenever the branch
# advances past the file's commit — e.g. someone merges a rename of the
# spec file and every previously-emitted /review URL starts 404'ing
# because raw.githubusercontent.com now resolves the branch to a newer
# commit where the file lives at a different path.
base_sha=$(jq -r '.pull_request.base.sha // empty' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "")
if [ -z "$base_sha" ]; then base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF" 2>/dev/null || echo "$GITHUB_BASE_REF"); fi
free_review_url="https://www.oasdiff.com/review?owner=${owner}&repo=${repo}&base_sha=$(urlencode "$base_sha")&rev_sha=${head_sha}&base_file=$(urlencode "$base_path")&rev_file=$(urlencode "$rev_path")"
echo "::notice::📋 Review & approve these breaking changes → ${free_review_url}"
echo "### 📋 [Review & approve these breaking changes](${free_review_url})" >> "$GITHUB_STEP_SUMMARY"
else
Expand Down
8 changes: 7 additions & 1 deletion changelog/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,13 @@ if [ -n "$output" ] && ! echo "$output" | head -n 1 | grep -q "^No "; then
repo="${GITHUB_REPOSITORY#*/}"
head_sha=$(jq -r '.pull_request.head.sha // empty' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "")
if [ -z "$head_sha" ]; then head_sha="$GITHUB_SHA"; fi
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")"
# base_sha must be an immutable commit SHA, not the branch name. Using
# $GITHUB_BASE_REF (the branch) makes the URL decay whenever the branch
# advances past the file's commit. See breaking/entrypoint.sh for the
# full rationale.
base_sha=$(jq -r '.pull_request.base.sha // empty' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "")
if [ -z "$base_sha" ]; then base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF" 2>/dev/null || echo "$GITHUB_BASE_REF"); fi
free_review_url="https://www.oasdiff.com/review?owner=${owner}&repo=${repo}&base_sha=$(urlencode "$base_sha")&rev_sha=${head_sha}&base_file=$(urlencode "$base_path")&rev_file=$(urlencode "$rev_path")"
echo "::notice::📋 Review & approve these API changes → ${free_review_url}"
echo "### 📋 [Review & approve these API changes](${free_review_url})" >> "$GITHUB_STEP_SUMMARY"
else
Expand Down
12 changes: 10 additions & 2 deletions pr-comment/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,16 @@ urlencode() { printf '%s' "$1" | jq -sRr @uri; }
base_path=$(echo "$base" | sed 's/.*://')
rev_path=$(echo "$revision" | sed 's/.*://')
# Prefer the base SHA over the branch name so the link is commit-pinned.
free_base_sha="${base_sha:-$GITHUB_BASE_REF}"
free_review_url="https://www.oasdiff.com/review?owner=${owner}&repo=${repo}&base_sha=${free_base_sha}&rev_sha=${head_sha}&base_file=$(urlencode "$base_path")&rev_file=$(urlencode "$rev_path")"
# Fall back through `git rev-parse origin/<branch>` before resorting to
# the branch name itself, so push-event triggers (no pull_request payload)
# also get an immutable SHA in the URL whenever the base branch was
# fetched into the workspace.
if [ -n "$base_sha" ]; then
free_base_sha="$base_sha"
else
free_base_sha=$(git rev-parse "origin/$GITHUB_BASE_REF" 2>/dev/null || echo "$GITHUB_BASE_REF")
fi
free_review_url="https://www.oasdiff.com/review?owner=${owner}&repo=${repo}&base_sha=$(urlencode "$free_base_sha")&rev_sha=${head_sha}&base_file=$(urlencode "$base_path")&rev_file=$(urlencode "$rev_path")"
echo "::notice::📋 View API changes → ${free_review_url}"

# Build the JSON payload
Expand Down
Loading