Fix workflow_run triggered builds by checking out latest commit with updated npm hash#1368
Merged
brianmcgillion merged 2 commits intomainfrom Sep 4, 2025
Merged
Fix workflow_run triggered builds by checking out latest commit with updated npm hash#1368brianmcgillion merged 2 commits intomainfrom
brianmcgillion merged 2 commits intomainfrom
Conversation
Co-authored-by: brianmcgillion <1044263+brianmcgillion@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] automatic npm deps update still fails to trigger
Fix workflow_run triggered builds by checking out latest commit with updated npm hash
Sep 4, 2025
brianmcgillion
approved these changes
Sep 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The automatic npm dependency hash update workflow was successfully updating hashes in
docs/default.nixwhen dependabot created PRs, but the subsequentdoc.ymlandbuild.ymlworkflows triggered byworkflow_runevents were failing with hash mismatch errors.Root Cause
The issue was that workflows triggered by
workflow_runevents were checking out the wrong commit. They usedgithub.event.workflow_run.head_shawhich points to the original dependabot commit before the hash was updated, not the latest commit on the branch after the hash update was committed.This caused a mismatch where the workflows were trying to build with:
package.jsonandpackage-lock.json(from dependabot)npmDepsHashindocs/default.nix(from before the update)Error Example
Solution
Modified both
doc.ymlandbuild.ymlworkflows to usegithub.ref(which resolves to the latest commit on the branch) when triggered byworkflow_runevents, while preserving the existing logic for other event types.Before:
After:
This ensures that when the "Update npmDepsHash" workflow completes and triggers other workflows via
workflow_run, those workflows will check out the latest commit on the branch that contains the updated hash.Verification
doc.yml(run ID 17453694487) andbuild.yml(run ID 17453694490) failed with hash mismatches when triggered byworkflow_runFixes #1367.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/tiiuae/ghaf/actions/runscurl -s -H Authorization: token REDACTED(http block)If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.