Skip to content

Fix: Trigger publish workflow on release published, not created - #338

Merged
RomiC merged 1 commit into
mainfrom
fix/release-published-trigger
Aug 7, 2026
Merged

Fix: Trigger publish workflow on release published, not created#338
RomiC merged 1 commit into
mainfrom
fix/release-published-trigger

Conversation

@RomiC

@RomiC RomiC commented Aug 7, 2026

Copy link
Copy Markdown
Owner

GitHub sends a published event when a draft release is published, which is not covered by the created trigger. published covers both draft publishing and direct release creation.

Closes #326

GitHub sends a 'published' event when a draft release is published,
which is not covered by the 'created' trigger. 'published' covers both
draft publishing and direct release creation.
@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown

Greptile Summary

This PR changes the npm publication workflow from the release.created event to release.published, allowing draft releases to trigger publication when made public.

  • Covers both directly published releases and draft-to-published transitions.
  • Also newly exposes draft prereleases to the workflow’s unconditional default npm publication tag.

Confidence Score: 4/5

The prerelease handling should be fixed before merging because publishing a draft prerelease can replace npm’s stable latest version.

The expanded release trigger reaches every published prerelease, while the unchanged unqualified npm publish command assigns the default npm dist-tag without distinguishing stable releases from prereleases.

Files Needing Attention: .github/workflows/npm-publish.yml

Important Files Changed

Filename Overview
.github/workflows/npm-publish.yml Changes the release event subtype as intended, but draft prereleases can now be published under npm’s default latest dist-tag.
Prompt To Fix All With AI
### Issue 1
.github/workflows/npm-publish.yml:5
**Prereleases overwrite the latest tag**

When a draft prerelease is published, the new `published` trigger starts this workflow and the unqualified `npm publish` assigns npm’s default `latest` dist-tag, causing normal package installs to resolve to the prerelease instead of the current stable release.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "Fix: Trigger publish workflow on release..." | Re-trigger Greptile

on:
release:
types: [created]
types: [published]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Prereleases overwrite the latest tag

When a draft prerelease is published, the new published trigger starts this workflow and the unqualified npm publish assigns npm’s default latest dist-tag, causing normal package installs to resolve to the prerelease instead of the current stable release.

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/npm-publish.yml
Line: 5

Comment:
**Prereleases overwrite the latest tag**

When a draft prerelease is published, the new `published` trigger starts this workflow and the unqualified `npm publish` assigns npm’s default `latest` dist-tag, causing normal package installs to resolve to the prerelease instead of the current stable release.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The project doesn't have pre-release versions

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fair enough — if the project doesn't use pre-releases, that concern doesn't apply. The change is correct then.

Shall I remember this as a rule: "this repo does not use pre-release versions, so no need to flag npm dist-tag issues related to prereleases"?

Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage is 100.0%fix/release-published-trigger into main. No base build found for main.

@RomiC
RomiC merged commit 51ae66e into main Aug 7, 2026
8 checks passed
@RomiC
RomiC deleted the fix/release-published-trigger branch August 7, 2026 07:35
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.

Fix: NPM publish workflow not triggered when publishing a draft release

2 participants