Skip to content

fix(GHA): use inputs.ref for publish eligibility in cli.yml#2297

Merged
jakobmoellerdev merged 2 commits into
open-component-model:mainfrom
morri-son:fix/cli-release-publish-check
Apr 15, 2026
Merged

fix(GHA): use inputs.ref for publish eligibility in cli.yml#2297
jakobmoellerdev merged 2 commits into
open-component-model:mainfrom
morri-son:fix/cli-release-publish-check

Conversation

@morri-son

Copy link
Copy Markdown
Contributor

Summary

  • Fix publish gating in cli.yml: When called via workflow_call from cli-release.yml, GITHUB_REF_NAME inherits the caller's ref (releases/v0.4) instead of the RC tag (cli/v0.4.0-rc.1). The should_push_oci_image check only matched main or cli/v*, so the Publish and Attest job was skipped for releases dispatched from release branches. Now uses inputs.ref when available.
  • Update RELEASE_PROCESS.md: Replace stale "Branch to release from" input reference with the "Use workflow from" branch selector, matching the workflow change in chore: streamline release workflows and CLI build versioning #2131.

Root Cause

After #2131 removed the explicit branch text input from cli-release.yml, the operator must select the releases/v* branch in the GitHub UI "Use workflow from" dropdown. This sets GITHUB_REF_NAME = "releases/v0.4" for the entire call chain.

cli.yml's branch-check (should_push_oci_image) tests GITHUB_REF_NAME against:

  1. Default branch (main) — no match
  2. cli/v* tag pattern — no match

Result: Publish and Attest skipped → Conformance skipped.

The v0.3 release worked because the old workflow was dispatched from main (the text input carried the branch separately), so GITHUB_REF_NAME = "main" matched condition 1.

Fix

Use inputs.ref (the RC tag, e.g. cli/v0.4.0-rc.1) when present, fall back to GITHUB_REF_NAME for direct triggers. The RC tag matches the cli/v* pattern, enabling publish.

Trigger inputs.ref Effective ref Publishes
workflow_call from cli-release.yml cli/v0.4.0-rc.1 cli/v0.4.0-rc.1 Yes
Push to main empty main Yes
Push tag cli/v0.4.0 empty cli/v0.4.0 Yes
Push to releases/v0.4 empty releases/v0.4 No (build-only)
Pull request n/a step skipped No

Test plan

  • Verify the v0.4 release workflow can be re-run successfully from releases/v0.4 after this change is cherry-picked
  • Dry-run a CLI release from a release branch to confirm Publish and Attest job is no longer skipped

When cli-release.yml calls cli.yml via workflow_call, GITHUB_REF_NAME
inherits the caller's ref (releases/v0.4) instead of the RC tag
(cli/v0.4.0-rc.1). The branch-check only allowed publishing for main
or cli/v* refs, so releases dispatched from release branches skipped
the Publish and Attest job entirely.

Use inputs.ref (the RC tag passed by cli-release.yml) when available,
falling back to GITHUB_REF_NAME for direct push/tag triggers.

Also update RELEASE_PROCESS.md to replace the removed "Branch to
release from" input reference with "Use workflow from" branch selector.

Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
@morri-son morri-son requested a review from a team as a code owner April 15, 2026 12:51
@github-actions github-actions Bot added the kind/bugfix Bug label Apr 15, 2026
@netlify

netlify Bot commented Apr 15, 2026

Copy link
Copy Markdown

Deploy Preview for ocm-website canceled.

Name Link
🔨 Latest commit d2d4726
🔍 Latest deploy log https://app.netlify.com/projects/ocm-website/deploys/69df8a59f357b90008f06eb0

@github-actions github-actions Bot added size/s Small component/github-actions Changes on GitHub Actions or within `.github/` directory labels Apr 15, 2026
Add comments explaining the dispatch model and github.ref_name behavior
across the cli-release.yml → cli.yml workflow_call boundary.

Key documentation:
- cli-release.yml: operator must select releases/v* in "Use workflow from"
- cli-release.yml build job: inputs.ref carries the RC tag, not the branch
- cli.yml top: dual-role (CI + reusable) and ref inheritance caveat
- cli.yml branch-check: publish eligibility table for all trigger scenarios

Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
@jakobmoellerdev jakobmoellerdev merged commit aa48cc6 into open-component-model:main Apr 15, 2026
28 checks passed
morri-son added a commit that referenced this pull request Apr 15, 2026
## Summary
Cherry-pick of #2297 to `releases/v0.4`.

- Fix publish eligibility check in `cli.yml` to use `inputs.ref` (RC
tag) instead of `GITHUB_REF_NAME` (branch) for `workflow_call` triggers
- Add documentation for `workflow_call` ref inheritance behavior across
release workflows

---------

Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
Co-authored-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
ocmbot2 Bot pushed a commit to morri-son/open-component-model that referenced this pull request Apr 15, 2026
…ponent-model#2297)

## Summary

- **Fix publish gating in `cli.yml`**: When called via `workflow_call`
from `cli-release.yml`, `GITHUB_REF_NAME` inherits the caller's ref
(`releases/v0.4`) instead of the RC tag (`cli/v0.4.0-rc.1`). The
`should_push_oci_image` check only matched `main` or `cli/v*`, so the
Publish and Attest job was skipped for releases dispatched from release
branches. Now uses `inputs.ref` when available.
- **Update `RELEASE_PROCESS.md`**: Replace stale "Branch to release
from" input reference with the "Use workflow from" branch selector,
matching the workflow change in open-component-model#2131.

## Root Cause

After open-component-model#2131 removed the explicit `branch` text input from
`cli-release.yml`, the operator must select the `releases/v*` branch in
the GitHub UI "Use workflow from" dropdown. This sets `GITHUB_REF_NAME =
"releases/v0.4"` for the entire call chain.

`cli.yml`'s branch-check (`should_push_oci_image`) tests
`GITHUB_REF_NAME` against:
1. Default branch (`main`) — no match
2. `cli/v*` tag pattern — no match

Result: Publish and Attest skipped → Conformance skipped.

The v0.3 release worked because the old workflow was dispatched from
`main` (the text input carried the branch separately), so
`GITHUB_REF_NAME = "main"` matched condition 1.

## Fix

Use `inputs.ref` (the RC tag, e.g. `cli/v0.4.0-rc.1`) when present, fall
back to `GITHUB_REF_NAME` for direct triggers. The RC tag matches the
`cli/v*` pattern, enabling publish.

| Trigger | `inputs.ref` | Effective ref | Publishes |
|---------|-------------|---------------|-----------|
| `workflow_call` from `cli-release.yml` | `cli/v0.4.0-rc.1` |
`cli/v0.4.0-rc.1` | Yes |
| Push to `main` | empty | `main` | Yes |
| Push tag `cli/v0.4.0` | empty | `cli/v0.4.0` | Yes |
| Push to `releases/v0.4` | empty | `releases/v0.4` | No (build-only) |
| Pull request | n/a | step skipped | No |

## Test plan

- [ ] Verify the v0.4 release workflow can be re-run successfully from
`releases/v0.4` after this change is cherry-picked
- [ ] Dry-run a CLI release from a release branch to confirm Publish and
Attest job is no longer skipped

---------

Signed-off-by: Gerald Morrison (SAP) <gerald.morrison@sap.com>
Co-authored-by: Gerald Morrison (SAP) <gerald.morrison@sap.com> aa48cc6
@morri-son morri-son deleted the fix/cli-release-publish-check branch April 23, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/github-actions Changes on GitHub Actions or within `.github/` directory kind/bugfix Bug size/s Small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants