Working around No artifacts named "github-pages" were found for this workflow run. in GitHub Actions

The GitHub logo, with an Octocat next to it

For over a month, there's been a report of a bug in how GitHub Actions deploys to GitHub Pages, where - even if you literally just uploaded it, GitHub Actions tells you:

# via https://github.com/renovatebot/renovate/actions/runs/45665733508/job/139394524535
Found 19 artifact(s)
Error: Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.
Error: Error: No artifacts named "github-pages" were found for this workflow run. Ensure artifacts are uploaded with actions/upload-artifact@v4 or later.

If you can't tell, this has been fairly frustrating to me this week. In the last two weeks, this has contributed 19/28 of our failed builds on Renovate's main branch, and has been a noisy issue that's also led to our docs site being out-of-date for a number of hours at a time.

I set Claude Sonnet 5.5 on it (because it's late and I'm grumpy) and after a few attempts, we've come to the following hacky solution:

permissions:
  pages: write
  id-token: write

steps:
  # ...

  - name: Upload GitHub Pages artifact
    id: upload
    uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
    with:
      path: tools/mkdocs/site

  # Per https://github.com/actions/deploy-pages/issues/451, `deploy-pages` looks up the artifact once, and it may not be listed immediately after it is uploaded. Retry only the deploy, not the upload, as a second upload makes the lookup fail with multiple artifacts. Remove once https://github.com/actions/deploy-pages/pull/455 is released
  - name: Deploy to GitHub Pages
    id: deployment
    uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
    continue-on-error: true

  - name: Wait before retrying deploy to GitHub Pages
    if: steps.deployment.outcome == 'failure'
    run: sleep 5

  - name: Deploy to GitHub Pages (retry 1)
    id: deployment_retry_1
    if: steps.deployment.outcome == 'failure'
    uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
    continue-on-error: true

  - name: Wait before retrying deploy to GitHub Pages
    if: steps.deployment_retry_1.outcome == 'failure'
    run: sleep 20

  - name: Deploy to GitHub Pages (retry 2)
    id: deployment_retry_2
    if: steps.deployment_retry_1.outcome == 'failure'
    uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
    continue-on-error: true

  - name: Wait before retrying deploy to GitHub Pages
    if: steps.deployment_retry_2.outcome == 'failure'
    run: sleep 60

  - name: Deploy to GitHub Pages (retry 3)
    id: deployment_retry_3
    if: steps.deployment_retry_2.outcome == 'failure'
    uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1

I'd originally started by adding a loop to see if the artifact existed by the artifact_id or for the github-pages artifact name, but it looks like the way that actions/deploy-pages looks up the artifact is using different APIs than the REST API, so they're out-of-sync.

Instead, adding a bit of a wait between deploy attempts seems to work.

I'm hoping someone at GitHub picks up a fix for this soon - given the number of PRs you can see in the activity feed on the issue, it's causing quite a bit of impact across GitHub users right now.

Written by Jamie Tanna's profile image Jamie Tanna on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

πŸ€– Content in this blog post includes code derived from the following LLMs:

PurposeModelNotes
Codeclaude:sonnet-5.5Wrote the retry script
Editorial supportNo usage
Prose (verbatim or edited)No usage
Images, visualisation, data and/or metricsNo usage

Also on:

This post was filed under articles.

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.