Skip to content

fix(ci): detect workflow_run trigger correctly for dev publish mode - #2289

Merged
dfahlander merged 1 commit into
masterfrom
liz/fix-publish-mode-detection
Mar 31, 2026
Merged

fix(ci): detect workflow_run trigger correctly for dev publish mode#2289
dfahlander merged 1 commit into
masterfrom
liz/fix-publish-mode-detection

Conversation

@liz709

@liz709 liz709 commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Bug

After switching from push to workflow_run trigger in #2288, the MODE detection inside the script still checked for 'push':

if [ "${{ github.event_name }}" = "push" ]; then
  MODE="dev"
else
  MODE="${{ inputs.mode }}"  # empty on automatic runs!
fi

This caused MODE to be empty on automatic workflow_run triggers, which fell into the PR branch and tried to publish version 4.4.2-pr. (missing PR number → invalid semver).

Error from the failed run:

npm error Invalid version: "4.4.2-pr."

Fix

Check for workflow_run instead of push:

if [ "${{ github.event_name }}" = "workflow_run" ]; then
  MODE="dev"

Summary by CodeRabbit

  • Chores
    • Updated package publishing workflow to trigger automatic development releases on workflow run events in addition to push events.

After switching from 'push' to 'workflow_run' trigger, the MODE detection
still checked for 'push' — causing MODE to be empty on automatic runs,
which then fell into the PR branch and tried to publish '4.4.2-pr.' (invalid version).

Fix: check for 'workflow_run' instead of 'push'.
@coderabbitai

coderabbitai Bot commented Mar 31, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The publish.yml GitHub Actions workflow has been modified to treat workflow_run events as the trigger for automatic dev publishes, replacing the previous condition that used push events. The mode-selection conditional logic now sets MODE="dev" when the event type is workflow_run.

Changes

Cohort / File(s) Summary
Workflow Configuration
.github/workflows/publish.yml
Modified the mode-selection conditional to recognize workflow_run events as the automatic dev publish trigger instead of push events.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 A workflow now runs when workflows run,
No more pushing for dev builds—oh what fun!
The cascade begins, events flow with grace,
Publishing packages at a faster pace! 📦✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: fixing CI to correctly detect workflow_run trigger for dev publish mode, which directly corresponds to the changeset's core purpose.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch liz/fix-publish-mode-detection

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/publish.yml (1)

120-121: Stale comment references old trigger.

The comment on line 120 still says "push to master = dev" but the condition now checks for workflow_run. Consider updating the comment to match the actual logic.

📝 Suggested comment update
-          # Determine mode: push to master = dev, workflow_dispatch = use input
+          # Determine mode: workflow_run (after tests pass on master) = dev, workflow_dispatch = use input
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/publish.yml around lines 120 - 121, Update the stale
inline comment that reads "push to master = dev" to reflect the actual condition
being checked (the string if [ "${{ github.event_name }}" = "workflow_run" ]);
change it to something like "workflow_run = dev, workflow_dispatch = use input"
so the comment matches the conditional logic around github.event_name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/publish.yml:
- Around line 120-121: Update the stale inline comment that reads "push to
master = dev" to reflect the actual condition being checked (the string if [
"${{ github.event_name }}" = "workflow_run" ]); change it to something like
"workflow_run = dev, workflow_dispatch = use input" so the comment matches the
conditional logic around github.event_name.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c1795e0e-fda8-445c-92ac-a8026d529e7c

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee82c8 and 2a04e75.

📒 Files selected for processing (1)
  • .github/workflows/publish.yml

@dfahlander
dfahlander merged commit a308a2c into master Mar 31, 2026
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants