`pages_build_version` (GITHUB_SHA) is not unique for events that use last commit e.g. `release`, `workflow_dispatch`, etc.

Open
#383 10 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
github-actions, javascript
Domain
ci-cd, devops, release

Research direction

Start with src/internal/context.js at line 8 and review how the deployment payload is built, then reproduce the behavior with the provided push, release, and workflow_dispatch workflow. Check the Create a GitHub Pages deployment API requirements and related discussion; done means release and other last-commit events deploy the correct artifact with a unique accepted build version.

Written by the indexing model from the issue text.

Description

Currently, pages_build_version is always being set using GITHUB_SHA:

https://github.com/actions/deploy-pages/blob/854d7aa1b99e4509c4d1b53d69b7ba4eaf39215a/src/internal/context.js#L8

and, it also represents the deployment ID.

However, for events that use the last commit SHA e.g. release, workflow_dispatch, etc., GITHUB_SHA will not be unique.

Example:

push

Fetching artifact metadata for "github-pages" in this workflow run
Found 1 artifact(s)
Creating Pages deployment with payload:
{
	"artifact_id": 2351475241,
	"pages_build_version": "ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46",
	"oidc_token": "***"
}
Created deployment for ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46, ID: ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46
Getting Pages deployment status...
Reported success!

workflow_dispatch (after push)

Fetching artifact metadata for "github-pages" in this workflow run
Found 1 artifact(s)
Creating Pages deployment with payload:
{
	"artifact_id": 2351476924,
	"pages_build_version": "ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46",
	"oidc_token": "***"
}
Created deployment for ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46, ID: ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46
Getting Pages deployment status...
Reported success!

Observe ID: ae0b6be8565bc05ecef5aaa6c88c48ac2877ce46 in both cases.

Its impact (or side effect) is being observed as that sometimes the artifact is not updated at all.
The previous deployed artifacts is served instead.
Maybe, CDN caching also plays some role here, not sure though.

According to the Create a GitHub Pages deployment API, pages_build_version is supposed to be:

A unique string that represents the version of the build for this deployment.

It is suggested that instead of GITHUB_SHA, artifact_id (or some other unique combination) may be used for pages_build_version (deployment ID).

Let me know if more information is needed. Thanks!


UPDATE 20251116

See https://github.com/actions/deploy-pages/issues/383#issuecomment-3536590513.

Apparently, for release only, this behavior still exists i.e. the correct (latest) artifact is not deployed.
For release and workflow_dispatch, the flow is the same but the release artifact is not updated.
IIRC, at the time of reporting this issue, workflow_dispatch was also not working.

Tried to use a different string such as a timestamp for pages_build_version but Create a GitHub Pages deployment API call resulted in a 404 Not Found failure.
Here's a related discussion about setting pages_build_version other than GITHUB_SHA:
https://github.com/orgs/community/discussions/170184

Here's the workflow I used to reproduce this:

name: github_pages_deployment

on:
  push:
    branches: [main]
  release:
    types: [published]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-slim

    permissions:
      pages: write
      id-token: write

    environment:
      name: github-pages
      url: ${{ steps.deploy.outputs.page_url }}

    steps:
    - name: Setup
      run: |
        mkdir _site
        cat >"_site/index.html" <<EOF
        {
          "date": "$(date --utc)",
          "github.event_name": "${{ github.event_name }}",
          "github.ref_name": "${{ github.ref_name }}",
          "github.sha": "${{ github.sha }}"
        }
        EOF

    - name: Upload GitHub Pages artifact
      id: upload
      uses: actions/upload-pages-artifact@v4

    - name: Deploy to GitHub Pages
      id: deploy
      uses: actions/deploy-pages@v4

    - name: Verify
      env:
        ARTIFACT_ID: ${{ steps.upload.outputs.artifact_id }}
        URL: ${{ steps.deploy.outputs.page_url }}
      run: |
        {
          echo "### \`artifact_id\`: \`$ARTIFACT_ID\`"
          echo "### curl output:"
          echo '```json'
          curl -s "$URL" | jq .
          echo '```'
        } | tee -a "$GITHUB_STEP_SUMMARY"

Sample step summary:

### artifact_id: 4577379444
### curl output:
{
  "date": "Sat Nov 15 15:23:41 UTC 2025",
  "github.event_name": "push",
  "github.ref_name": "main",
  "github.sha": "385bffe607ebd2d20c3ab8845b1b652ac48e1312"
}

With this workflow:

  • Multiple push and workflow_dispatch events, consecutive or otherwise, work as expected i.e. correct artifact is deployed.
  • The release event uploads and identifies the correct artifact but it's not deployed.
    • Uploading the release artifact to the release assets also has no effect.
Workaround

As a workaround after publishing a release, an empty commit may be pushed

git commit --allow-empty -m "Trigger build"
git push

or workflow_dispatch may be added to the deployment workflow to manually trigger it.

Dominant language
JavaScript
Stars
967
Forks
147
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from actions/deploy-pages

All issues in actions/deploy-pages

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.