Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iamazeem opened this issue Dec 21, 2024 · 2 comments

Comments

@iamazeem
Copy link

Currently, pages_build_version is always being set using GITHUB_SHA:

buildVersion: process.env.GITHUB_SHA,

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!

@davidrg
Copy link

davidrg commented Jan 29, 2025

I've just run into this myself. The contents of the generated github pages artifact in my workflow differs depending on if the trigger was a tag or simply a push to a branch. I spent all of yesterday evening trying to figure out why pushing a commit would result in a deploy to github pages but pushing a tag would seem to do nothing even though the artifact generated by the workflow appeared to be correct. Only noticed tonight that the pages_build_version was the same for both workflow runs which seemed suspicious.

Looking forward to a fix as I don't see a way to achieve what I'm trying to do with this bug in the way.

@iamazeem
Copy link
Author

@davidrg: Hi! For the time being, you may directly use the Create a GitHub Pages deployment API to unblock you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants