Skip to content

WordPress Build: Use stable content hashes when building scripts#74035

Merged
youknowriad merged 2 commits intotrunkfrom
update/use-content-hash-for-versions
Dec 16, 2025
Merged

WordPress Build: Use stable content hashes when building scripts#74035
youknowriad merged 2 commits intotrunkfrom
update/use-content-hash-for-versions

Conversation

@youknowriad
Copy link
Contributor

Summary

Replaces Date.now() timestamps with SHA256 content hashes in build asset versioning to enable reproducible builds.
Core has a job that auto-commits on each "diff" discovered and this creates an infinite loop since each commit triggers the job which rebuilds and since we were using timestamps the build was slightly different each time.

This PR ensures wp-build generates the same "version" hashes if the content of the scripts didn't change.

Testing

Verified that:

  • Clean rebuilds produce identical hashes
  • Source changes trigger version updates for affected packages only
  • Unmodified packages maintain stable versions

Example

Before: 'version' => '1765880436119' (timestamp)
After: 'version' => 'a5b3a20a3d22575549c7' (content hash)

@youknowriad youknowriad self-assigned this Dec 16, 2025
@youknowriad youknowriad added the [Type] Build Tooling Issues or PRs related to build tooling label Dec 16, 2025
@github-actions
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: youknowriad <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions
Copy link

Flaky tests detected in 936e204.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/20266230281
📝 Reported issues:

@youknowriad youknowriad merged commit fd9449c into trunk Dec 16, 2025
34 checks passed
@youknowriad youknowriad deleted the update/use-content-hash-for-versions branch December 16, 2025 15:28
@github-actions github-actions bot added this to the Gutenberg 22.4 milestone Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant