fix: bootstrap retained feeds without Pages artifact
Build and test / Tests and license checks (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ramips-mt7621 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ramips-mt7621 (push) Has been cancelled
Build and test / Publish agent GitHub release assets (push) Has been cancelled
Build and test / Publish signed package repository (push) Has been cancelled
Build and test / Tests and license checks (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · x86-64 (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ipq40xx-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · mediatek-filogic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ath79-generic (push) Has been cancelled
Build and test / OpenWrt 24.10.7 · ramips-mt7621 (push) Has been cancelled
Build and test / OpenWrt 25.12.4 · ramips-mt7621 (push) Has been cancelled
Build and test / Publish agent GitHub release assets (push) Has been cancelled
Build and test / Publish signed package repository (push) Has been cancelled
This commit is contained in:
@@ -259,6 +259,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
actions: read
|
||||
pages: read
|
||||
id-token: write
|
||||
attestations: write
|
||||
@@ -295,15 +296,27 @@ jobs:
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="${GITHUB_REF_NAME#agent-v}"
|
||||
artifact_url="$(gh api "repos/${GITHUB_REPOSITORY}/pages/deployments?per_page=1" --jq '.[0].artifact_url // empty' || true)"
|
||||
artifact_url=""
|
||||
deployment_error="$(mktemp)"
|
||||
if ! artifact_url="$(gh api "repos/${GITHUB_REPOSITORY}/pages/deployments?per_page=1" --jq '.[0].artifact_url // empty' 2>"$deployment_error")"; then
|
||||
if grep -q 'HTTP 404' "$deployment_error"; then
|
||||
# The legacy repository has no readable Pages deployment artifact.
|
||||
# Bootstrap the retained immutable-feed layout without treating the error as a URL.
|
||||
artifact_url=""
|
||||
else
|
||||
cat "$deployment_error" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
rm -f "$deployment_error"
|
||||
if [ -n "$artifact_url" ]; then
|
||||
mkdir previous-pages
|
||||
curl --fail --location --retry 3 \
|
||||
--header "Authorization: Bearer ${GH_TOKEN}" \
|
||||
"$artifact_url" -o previous-pages.zip
|
||||
unzip -q previous-pages.zip -d previous-pages
|
||||
elif gh api "repos/${GITHUB_REPOSITORY}/pages/deployments?per_page=1" --jq 'length' | grep -qx '0'; then
|
||||
echo "No prior Pages deployment; publishing the first retained feed."
|
||||
elif [ -z "$artifact_url" ]; then
|
||||
echo "No readable prior Pages deployment; publishing the first retained immutable feed."
|
||||
else
|
||||
echo "Unable to retrieve the deployed Pages artifact; refusing to discard retained feeds." >&2
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user