diff --git a/.github/workflows/update-nutrient-sdk.yml b/.github/workflows/update-nutrient-sdk.yml index 1410e34..47bba4a 100644 --- a/.github/workflows/update-nutrient-sdk.yml +++ b/.github/workflows/update-nutrient-sdk.yml @@ -64,10 +64,16 @@ jobs: # example that gains a script tag without an entry is left behind in # silence. examples/salesforce/README.md is exempt: its version is an # illustration, not a pin. - stale="$(grep -rEn "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" examples/ \ + # + # -o prints one match per line rather than one line per match, so a + # line carrying both a bumped and a stale reference cannot have the + # stale one dropped along with the whole line. The exclusion escapes + # the dots in ${VERSION} and anchors on $, so 1.20.1 cannot swallow a + # stale 1.20.10 as a prefix of it. + stale="$(grep -rEon "pspdfkit-web@[0-9]+\.[0-9]+\.[0-9]+" examples/ \ --exclude-dir=node_modules --exclude-dir=dist \ --exclude-dir=.next --exclude-dir=.nuxt \ - | grep -v "pspdfkit-web@${VERSION}" \ + | grep -vE "pspdfkit-web@${VERSION//./\\.}$" \ | grep -v '^examples/salesforce/README.md:' || true)" if [ -n "$stale" ]; then @@ -158,6 +164,35 @@ jobs: [Workflow run](${RUN_URL}) BODY + # Nothing retries a draft. The scheduled job treats any pull request + # for this branch as "handled" whatever its state, so without these + # instructions the version is parked on whoever opens the draft next, + # with no way to re-run the suite from the pull request itself. + if [ "$E2E_OUTCOME" != "success" ]; then + cat >> /tmp/pr-body.md <&2 + exit 1 + fi + + if [ "${http_code}" != "200" ]; then + echo "@nutrient-sdk/viewer@${requested} is not published on the registry" \ + "(HTTP ${http_code})." >&2 + exit 1 + fi +fi + # jq -r prints "null" and exits 0 for a missing key, which would silently # disable the already-on-this-version check. if ! current="$(jq -er '.dependencies["@nutrient-sdk/viewer"]' \