Skip to content

Release on push so fork contributions can publish - #29

Merged
woksin merged 2 commits into
mainfrom
chore/publish-on-push
Aug 22, 2026
Merged

Release on push so fork contributions can publish#29
woksin merged 2 commits into
mainfrom
chore/publish-on-push

Conversation

@woksin

@woksin woksin commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

A pull request from a fork cannot cut a release, and the run reports success anyway — so a merged, labeled contribution silently publishes nothing.

Added

  • A check requiring exactly one major, minor or patch label before a pull request can be merged.

Changed

  • Releases are cut on push to main instead of on the pull request closing, so contributions from forks publish like any other.
  • The Publish run now fails when a merge releases nothing because the version label was missing, instead of reporting success.

woksin and others added 2 commits August 15, 2026 13:25
A pull request from a fork runs with a read-only GITHUB_TOKEN and no secrets even
on merge, so the release job cannot create the release and the publishing jobs have
no credentials - while the run still reports success. A push to main always runs
with a full-permission token, and the release action resolves the merged pull
request and its label from the commit rather than from the event payload.

Concurrency stops cancelling as part of this: every merge to main shares one group,
so the next merge would otherwise cancel a release possibly mid-publish.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Catching a missing label after the merge means the release is already lost and has
to be cut by hand. Requiring it on the pull request moves the failure to where it
costs nothing to fix, and removes the race where a label added just after the merge
lands too late to count.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@woksin woksin added the patch label Aug 15, 2026
@woksin

woksin commented Aug 15, 2026

Copy link
Copy Markdown
Contributor Author

Reviewer context. Part of an org-wide migration; Cratis/cli is already migrated and has cut a release this way (v2.8.1).

Why. A fork pull request runs with a read-only GITHUB_TOKEN and no secrets even on merge, so the release job cannot tag and the publish jobs have no credentials — while the run still reports success. Cratis/cli#72 merged with a minor label and released nothing. On push the token is full-permission, and the action resolves the pull request and its label live from the commit instead of from the event payload, which also closes the label-added-just-after-merge race.

Not pull_request_target. NuGet rejects it — GitHubTokenPolicyValidator checks event_name against BannedGitHubActionsEvents. push is not on that list, and cli published on push successfully.

cancel-in-progress must be false. Under pull_request each run had its own github.ref; on push every merge shares refs/heads/main, so leaving it true lets the next merge cancel a release possibly mid-publish.

Depends on release-action v1.2.0, which added the reason output. @v1 already points at it.

The paths filter is kept deliberately, against the action README's advice: the new check fails an unlabeled merge, and docs-only pull requests carry no label by design, so without the filter every docs merge would go red on main.

No concurrency block in this workflow, so there is nothing to cancel and none was added.

Specifications-specific. There is no separate release job here — the action runs as a step inside publish — so the released-nothing check is a final step keyed on steps.release.outputs.reason rather than a separate job. The trigger also had no branch filter at all, so it released from any base branch; it is now scoped to main.

Verification. Parses as YAML; trigger resolves to push on main; no github.event.pull_request or event_name == 'pull_request' references remain; the release job exposes reason. Not merged — over to you.

@woksin
woksin merged commit a5cc7a1 into main Aug 22, 2026
1 of 2 checks passed
@woksin
woksin deleted the chore/publish-on-push branch August 22, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant