Skip to content
Open
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
20 changes: 20 additions & 0 deletions .github/workflows/pr-playground-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ jobs:
if-no-files-found: error
retention-days: 5

# The expose step downloads the artifact by its ID a moment after it is uploaded, and GitHub sometimes
# answers "No artifacts found for ID" because the upload is not visible yet. Wait until the run lists it.
- name: Wait until the uploaded artifact is available
env:
GH_TOKEN: ${{ github.token }}
ARTIFACT_NAME: frontblocks-zip-pr${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}
run: |
for attempt in 1 2 3 4 5 6 7 8 9 10; do
found=$(gh api "repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/artifacts" \
--jq "[.artifacts[] | select(.name == env.ARTIFACT_NAME and .expired == false)] | length")
if [ "${found}" -gt 0 ]; then
echo "Artifact listed after ${attempt} attempt(s)."
sleep 5
exit 0
fi
echo "Artifact not listed yet (attempt ${attempt}/10), waiting."
sleep 6
done
echo "::warning::The artifact was not listed after 60 seconds; trying the next step anyway."

- name: Expose built artifact as a public URL
id: expose
uses: WordPress/action-wp-playground-pr-preview/.github/actions/expose-artifact-on-public-url@v4
Expand Down
Loading