-
Notifications
You must be signed in to change notification settings - Fork 843
Fix H5P webpack build hashing and GitHub action PR logic #13933
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
base: develop
Are you sure you want to change the base?
Fix H5P webpack build hashing and GitHub action PR logic #13933
Conversation
Addresses three issues with the H5P library update system: 1. Fix webpack mode and hashing: Changed mode from 'none' to 'production'. Production mode automatically enables deterministic module/chunk IDs, ensuring builds are reproducible. Also changed HTML filename from [fullhash] to [contenthash] so it only changes when HTML content actually changes, not on every compilation. 2. Improve GitHub action logic: Added a check for actual build changes before creating a PR. The action now only creates a PR when the built files in kolibri/core/content/static/h5p/ change, not just when the commit SHA file changes. This prevents unnecessary PRs when upstream commits don't affect the bundled JavaScript. 3. Improve PR title and description: Updated the auto-generated PR to have a clear title and concise, well-formatted description with commit information and upstream comparison links.
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
WalkthroughThe changes involve a GitHub workflow for H5P library updates and webpack configuration adjustments. The workflow now checks for actual build changes before running dependent steps and updates PR metadata. The webpack config switches to production mode with deterministic identifiers and content-based hash output naming. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Build Artifacts
|
rtibbles
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be good for human review.
| yarn workspace kolibri-sandbox run build-h5p | ||
| - name: Generate App Token | ||
| - name: Check for actual build changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously this would make a PR every time the commit changed, regardless of whether the upstream changes actually affected us.
| branch: h5p_update | ||
| delete-branch: true | ||
| title: 'Update from target repository commit' | ||
| title: 'Update H5P JavaScript library' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what I was thinking with these previous titles and descriptions - these show much better what we're actually doing with this upgrade PR.
| path: path.resolve(__dirname, '../../kolibri/core/content/static/h5p'), | ||
| }, | ||
| mode: 'none', | ||
| mode: 'production', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea why way back when I decided to do this - probably because I copied it from the main kolibri-sandbox webpack configuration.
| ], | ||
| }, | ||
| optimization: { | ||
| moduleIds: 'deterministic', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'production' above should set this automatically, but doing this for good measure, ensures that the build as a whole is deterministic.
| new Plugin(), | ||
| new HtmlWebpackPlugin({ | ||
| filename: 'h5p-[fullhash].html', | ||
| filename: 'h5p-[contenthash].html', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hashing the content, rather than a full hash, makes sure that the filename is deterministic - this matches the naming we do for the JS and CSS assets also.
Summary
Addresses three issues with the H5P library update system:
Fix webpack mode and hashing: Changed mode from 'none' to 'production'. Production mode automatically enables deterministic module/chunk IDs, ensuring builds are reproducible. Also changed HTML filename from [fullhash] to [contenthash] so it only changes when HTML content actually changes, not on every compilation.
Improve GitHub action logic: Added a check for actual build changes before creating a PR. The action now only creates a PR when the built files in kolibri/core/content/static/h5p/ change, not just when the commit SHA file changes. This prevents unnecessary PRs when upstream commits don't affect the bundled JavaScript.
Improve PR title and description: Updated the auto-generated PR to have a clear title and concise, well-formatted description with commit information and upstream comparison links.
References
Should prevent no-op upgrade PRs like #13924
Reviewer guidance
🤖 This was created by Claude Code. @rtibbles then reviewed the generated output, and did iterative rounds of updates before making it ready for review 🤖
The main thing to test here would be to run the H5P build locally and ensure that repeated runs produce deterministic outputs. Alternatively, we can merge and test it live!