From cc9252a9e3b3f2c14573763a2ddf10765fcb1e9c Mon Sep 17 00:00:00 2001 From: hlaelissalt Date: Wed, 25 Nov 2026 06:18:18 +0100 Subject: [PATCH] fix: the deployment of the portal waits until GitHub lists the artifact it just uploaded --- .github/workflows/pages.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 3b139b3..66888fd 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -12,6 +12,7 @@ on: workflow_dispatch: permissions: + actions: read contents: read pages: write id-token: write @@ -44,5 +45,21 @@ jobs: - uses: actions/upload-pages-artifact@v3 with: path: dist + # GitHub lists a new artifact a few seconds after it is uploaded, and deploy-pages looks for it at once: when the list is + # late it stops with "Found 0 artifact(s)" although the artifact exists. This waits until the list returns it (2 minutes at most). + - name: Wait until GitHub lists the artifact + env: + GH_TOKEN: ${{ github.token }} + run: | + for attempt in $(seq 1 24); do + found=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts" --jq '[.artifacts[] | select(.name == "github-pages")] | length') + if [ "${found}" -gt 0 ]; then + echo "The artifact is listed (attempt ${attempt})." + exit 0 + fi + echo "The artifact is not listed yet (attempt ${attempt}); waiting 5 seconds." + sleep 5 + done + echo "The artifact was not listed after 2 minutes; deploy-pages will try anyway." - id: deployment uses: actions/deploy-pages@v4