Skip to content

ci: publish a PR opened with preview from its label run only - #307

Merged
rqbazan merged 2 commits into
mainfrom
ci/opened-preview
Nov 5, 2026
Merged

rqbazan merged 2 commits into
mainfrom
ci/opened-preview

Conversation

@rqbazan

@rqbazan rqbazan commented Nov 5, 2026

Copy link
Copy Markdown
Member

Summary

A label set when a PR is opened fires a labeled run of its own, and since #306 that run has its own concurrency group. On a branch other than feat/* or fix/*, a PR opened with preview published the same commit from its opened run and from its labeled preview run, and the second failed as a duplicate version. Now only the label run publishes it.

 Publish preview:
-  if: (opened/synchronize/reopened && (feat/fix branch || PR has `preview`))
-   || (labeled `preview` && branch is not feat/fix)
+  if: (not labeled && feat/fix branch)
+   || (labeled `preview` && branch is not feat/fix)
+   || (synchronize/reopened && PR has `preview`)

Evidence

  • Before: opened with preview on ci/x → yes, and its labeled preview run → yes. That is two publishes of one commit, and the second fails.
    After: opened → no, labeled preview → yes.

  • The if, parsed from ci.yml on main (before) and on this branch (after), was evaluated with GitHub's expression engine (@actions/expressions 0.3.61) over every combination of event, branch, the label a labeled run adds, and the labels on the PR: 49 cases, 0 that differ from the rules below, and only the two opened + preview rows on another branch change.

    Run Branch Labels on the PR Before After
    opened ci/x preview (± chore) yes no
    labeled preview ci/x preview (± chore) yes yes
    synchronize, reopened ci/x preview (± chore) yes yes
    opened, synchronize, reopened ci/x none, chore no no
    labeled chore ci/x chore (± preview) no no
    opened, synchronize, reopened feat/x, fix/x any yes yes
    labeled preview or chore feat/x, fix/x any no no
    push main — no no
All 49 cases
Run Branch Labels on the PR Before After
push main — no no
opened feat/x — yes yes
opened feat/x preview yes yes
opened feat/x chore yes yes
opened feat/x preview, chore yes yes
opened fix/x — yes yes
opened fix/x preview yes yes
opened fix/x chore yes yes
opened fix/x preview, chore yes yes
opened ci/x — no no
opened ci/x preview yes no
opened ci/x chore no no
opened ci/x preview, chore yes no
synchronize feat/x — yes yes
synchronize feat/x preview yes yes
synchronize feat/x chore yes yes
synchronize feat/x preview, chore yes yes
synchronize fix/x — yes yes
synchronize fix/x preview yes yes
synchronize fix/x chore yes yes
synchronize fix/x preview, chore yes yes
synchronize ci/x — no no
synchronize ci/x preview yes yes
synchronize ci/x chore no no
synchronize ci/x preview, chore yes yes
reopened feat/x — yes yes
reopened feat/x preview yes yes
reopened feat/x chore yes yes
reopened feat/x preview, chore yes yes
reopened fix/x — yes yes
reopened fix/x preview yes yes
reopened fix/x chore yes yes
reopened fix/x preview, chore yes yes
reopened ci/x — no no
reopened ci/x preview yes yes
reopened ci/x chore no no
reopened ci/x preview, chore yes yes
labeled preview feat/x preview no no
labeled chore feat/x chore no no
labeled preview feat/x preview, chore no no
labeled chore feat/x preview, chore no no
labeled preview fix/x preview no no
labeled chore fix/x chore no no
labeled preview fix/x preview, chore no no
labeled chore fix/x preview, chore no no
labeled preview ci/x preview yes yes
labeled chore ci/x chore no no
labeled preview ci/x preview, chore yes yes
labeled chore ci/x preview, chore no no
  • Publish preview is skipped on this PR's own runs (a ci/ branch with no preview), which shows that the folded if parses. No preview label was added and no feat/fix branch was pushed to check it, because both publish to npm.
  • Local: actionlint 1.7.12, zizmor 1.31.1 (offline and online), pnpm rr check, pnpm test.

Merge Danger

Door: two-way

Blast Radius: CI

🤖 Generated with Claude Code

https://claude.ai/code/session_018BeQzzyPntbJyPicYWDqo3

rqbazan and others added 2 commits November 5, 2026 16:02
A label set when a PR is opened fires a `labeled` run of its own. On a branch other
than feat/fix, both that run and the `opened` run published the commit, so the
second failed as a duplicate version. The `opened` run no longer publishes for the
label; synchronize and reopened runs still do while the PR has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BeQzzyPntbJyPicYWDqo3
Drop "one publish per commit" (a reopen on a published commit publishes it again),
keep each condition of the label clause on its own line, and say in § CI which run
publishes a PR opened with `preview`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018BeQzzyPntbJyPicYWDqo3
@changeset-bot

changeset-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 43a0b19

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes

Reviewed the Publish preview condition and the CI note that says which run publishes a pull request opened with preview.

  • Preview gate — An opened run on a branch that does not start with feat or fix no longer publishes when the pull request already has preview. The labeled run that adds preview still does, and later synchronize or reopened runs still do while the label is present. Branches that start with feat or fix still publish from every non-label run, and a label run on those branches still does not.
  • Docs — The CI section now says that opening such a pull request with preview publishes from the label run, not the opened run.

Pullfrog  | View workflow run | Using grok-4.7 | 𝕏

@rqbazan
rqbazan merged commit c3069dc into main Nov 5, 2026
12 checks passed
@rqbazan
rqbazan deleted the ci/opened-preview branch November 5, 2026 21:19
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.

1 participant