diff --git a/.github/workflows/test-breaking.yaml b/.github/workflows/test-breaking.yaml
index ea80750..a0b5957 100644
--- a/.github/workflows/test-breaking.yaml
+++ b/.github/workflows/test-breaking.yaml
@@ -379,7 +379,7 @@ jobs:
i=1
while [ "$i" -le 7 ]; do
[ "$i" -gt 1 ] && printf ','
- printf '{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets%s","section":"paths"}' "$i"
+ printf '{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets%s","section":"paths","fingerprint":"fp%s"}' "$i" "$i"
i=$((i+1))
done
printf ']'
@@ -433,10 +433,8 @@ jobs:
echo "$body"
for expected in \
'7 breaking changes in this pull request' \
- '| severity | change | endpoint |' \
- 'API removed [' \
- 'https://www.oasdiff.com/checks/api-removed-without-deprecation' \
- 'GET /pets5' \
+ '| severity | change | endpoint | diff |' \
+ '| error | API removed | GET /pets5 | [view](https://www.oasdiff.com/review/e/stub-id?highlight=fp5#k=stub-key) |' \
'2 more
' \
'GET /pets6' \
'oasdiff Pro'
@@ -485,7 +483,7 @@ jobs:
esac
done
case "${fmt:-text}" in
- json) printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths"}]' ;;
+ json) printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths","fingerprint":"abc123def456"}]' ;;
gha) echo "::error file=specs/base.yaml,line=11::API removed" ;;
open) echo "https://www.oasdiff.com/review/e/stub-id#k=stub-key" >&2 ;;
*) echo "1 changes: 1 error, 0 warning, 0 info" ;;
@@ -605,7 +603,7 @@ jobs:
cat > /tmp/stub/oasdiff <<'STUB'
#!/bin/sh
- for a in "$@"; do [ "$a" = "json" ] && { printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths"}]'; exit 0; }; done
+ for a in "$@"; do [ "$a" = "json" ] && { printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths","fingerprint":"abc123def456"}]'; exit 0; }; done
for a in "$@"; do
if [ "$a" = "--open" ]; then
echo "$1" > /tmp/run/open-command
@@ -659,8 +657,8 @@ jobs:
for expected in \
'1 breaking change in this pull request' \
'status check on this pull request shows whether they are all approved' \
- '| severity | change | endpoint |' \
- 'api-removed-without-deprecation' \
+ '| severity | change | endpoint | diff |' \
+ '| error | API removed | GET /pets | [view](https://www.oasdiff.com/review/ep/test-token-uuid?highlight=abc123def456#k=test-key) |' \
'Review and approve the changes'
do
case "$pro_body" in
@@ -696,7 +694,7 @@ jobs:
#!/bin/sh
for a in "$@"; do
case "$a" in
- json) printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths"}]'; exit 0 ;;
+ json) printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths","fingerprint":"abc123def456"}]'; exit 0 ;;
githubactions) echo "::error file=specs/base.yaml,line=11::API removed"; exit 0 ;;
--open)
echo "oasdiff: opening review at https://www.oasdiff.com/review/ep/test-token-uuid#k=test-key" >&2
diff --git a/.github/workflows/test-changelog.yaml b/.github/workflows/test-changelog.yaml
index 273a4b0..8de5a46 100644
--- a/.github/workflows/test-changelog.yaml
+++ b/.github/workflows/test-changelog.yaml
@@ -111,7 +111,7 @@ jobs:
# on the args.
cat > /tmp/stub/oasdiff <<'STUB'
#!/bin/sh
- for a in "$@"; do [ "$a" = "json" ] && { printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths"}]'; exit 0; }; done
+ for a in "$@"; do [ "$a" = "json" ] && { printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths","fingerprint":"abc123def456"}]'; exit 0; }; done
for a in "$@"; do
if [ "$a" = "--open" ]; then
echo 'Error: upload failed (HTTP 402): {"code":"subscription_expired","message":"Your oasdiff trial or subscription has expired. Renew at https://www.oasdiff.com/pricing to continue using oasdiff Pro.","upgrade_url":"https://www.oasdiff.com/pricing"}' >&2
@@ -178,7 +178,7 @@ jobs:
cat > /tmp/stub/oasdiff <<'STUB'
#!/bin/sh
- for a in "$@"; do [ "$a" = "json" ] && { printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths"}]'; exit 0; }; done
+ for a in "$@"; do [ "$a" = "json" ] && { printf '[{"id":"api-removed-without-deprecation","text":"API removed","level":3,"operation":"GET","path":"/pets","section":"paths","fingerprint":"abc123def456"}]'; exit 0; }; done
for a in "$@"; do
if [ "$a" = "--open" ]; then
echo "oasdiff: opening review at https://www.oasdiff.com/review/ep/test-token-uuid#k=test-key" >&2
@@ -240,8 +240,8 @@ jobs:
for expected in \
'1 API change in this pull request' \
'status check on this pull request shows whether they are all approved' \
- '| severity | change | endpoint |' \
- 'api-removed-without-deprecation' \
+ '| severity | change | endpoint | diff |' \
+ 'API removed' \
'Review and approve the changes'
do
case "$pro_body" in
@@ -289,7 +289,7 @@ jobs:
printf ',{"id":"response-property-became-optional","text":"added @octocat [l](https://e.example) ","level":1,"operation":"POST","path":"/pets","section":"paths"}'
i=3
while [ "$i" -le 6 ]; do
- printf ',{"id":"request-property-added","text":"added","level":1,"operation":"PUT","path":"/pets%s","section":"paths"}' "$i"
+ printf ',{"id":"request-property-added","text":"added","level":1,"operation":"PUT","path":"/pets%s","section":"paths","fingerprint":"fp%s"}' "$i" "$i"
i=$((i+1))
done
printf ']'
@@ -339,8 +339,8 @@ jobs:
echo "$body"
for expected in \
'6 API changes in this pull request' \
- 'api-removed-without-deprecation' \
- 'response-property-became-optional' \
+ '| severity | change | endpoint | diff |' \
+ 'PUT /pets3 | [view](https://www.oasdiff.com/review/e/stub-id?highlight=fp3#k=stub-key) |' \
'| error | ' \
'| info | ' \
'1 more
' \
diff --git a/breaking/entrypoint.sh b/breaking/entrypoint.sh
index 250001c..bf3809e 100755
--- a/breaking/entrypoint.sh
+++ b/breaking/entrypoint.sh
@@ -88,13 +88,25 @@ from_fork () {
# the rest collapse, up to $comment_rows_listed, since a changelog can run to
# thousands of changes and a GitHub comment is limited to 65,536 characters.
# $1: the json render of the comparison (Run 3).
+# $2: the review URL. Each row links to its own change in the review, which
+# opens on the side-by-side diff of that change.
comment_rows_shown=5
comment_rows_listed=50
review_comment_changes () {
changes_file="$1"
+ changes_review_url="${2:-}"
[ -s "$changes_file" ] || return 0
- jq -r --argjson shown "$comment_rows_shown" --argjson listed "$comment_rows_listed" '
+ # The key is the URL's fragment, so the change goes in the query before it.
+ review_page="${changes_review_url%%#*}"
+ review_key="${changes_review_url#"$review_page"}"
+ case "$review_page" in
+ *\?*) review_page="${review_page}&highlight=" ;;
+ *) review_page="${review_page}?highlight=" ;;
+ esac
+
+ jq -r --argjson shown "$comment_rows_shown" --argjson listed "$comment_rows_listed" \
+ --arg page "$review_page" --arg key "$review_key" '
def severity: if . == 3 then "error" elif . == 2 then "warning" else "info" end;
def endpoint:
if (.operation // "") == "" then (.section // "") else .operation + " " + .path end;
@@ -108,9 +120,11 @@ review_comment_changes () {
| gsub("`"; "`") | gsub("\\|"; "|") | gsub("\\*"; "*")
| gsub("_"; "_") | gsub("://"; "://") | gsub("www\\."; "www.")
| gsub("[\r\n]+"; " ");
+ def diff_link:
+ if $key == "" or (.fingerprint // "") == "" then "" else "[view](" + $page + (.fingerprint | @uri) + $key + ")" end;
def row: "| " + (.level | severity) + " | " + ((.text // "") | inert)
- + " [`" + .id + "`](https://www.oasdiff.com/checks/" + .id + ") | " + (endpoint | inert) + " |";
- def header: "| severity | change | endpoint |", "| --- | --- | --- |";
+ + " | " + (endpoint | inert) + " | " + diff_link + " |";
+ def header: "| severity | change | endpoint | diff |", "| --- | --- | --- | --- |";
sort_by([-.level, (.path // ""), (.operation // ""), .id]) as $all
| ($all | length) as $total
| header,
@@ -189,7 +203,7 @@ post_review_comment () {
body="${marker}
### ${comment_icon} ${heading}
-$(review_comment_changes "${changes_json:-}")
+$(review_comment_changes "${changes_json:-}" "$review_url")
[See them side by side, with the old and new spec](${review_url}) (the link expires in 7 days)
@@ -337,7 +351,7 @@ pro_comment () {
${status_line}
-$(review_comment_changes "${changes_json:-}")
+$(review_comment_changes "${changes_json:-}" "$review_url")
[Review and approve the changes](${review_url})
diff --git a/false b/false
new file mode 100644
index 0000000..0755a07
--- /dev/null
+++ b/false
@@ -0,0 +1,2 @@
+No changes
+No changes