Fix: Trigger publish workflow on release published, not created - #338
Conversation
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 SummaryThis PR changes the npm publication workflow from the
Confidence Score: 4/5The prerelease handling should be fixed before merging because publishing a draft prerelease can replace npm’s stable The expanded release trigger reaches every published prerelease, while the unchanged unqualified Files Needing Attention: .github/workflows/npm-publish.yml
|
| 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] |
There was a problem hiding this 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.
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.There was a problem hiding this comment.
The project doesn't have pre-release versions
There was a problem hiding this comment.
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.
GitHub sends a
publishedevent when a draft release is published, which is not covered by thecreatedtrigger.publishedcovers both draft publishing and direct release creation.Closes #326