Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

feat(workflow run): retrieve workflow dispatch run details#12695

Merged
babakks merged 12 commits intotrunkcli/cli:trunkfrom
babakks/retrieve-workflow-dispatch-run-idcli/cli:babakks/retrieve-workflow-dispatch-run-idCopy head branch name to clipboard
Feb 17, 2026
Merged

feat(workflow run): retrieve workflow dispatch run details#12695
babakks merged 12 commits intotrunkcli/cli:trunkfrom
babakks/retrieve-workflow-dispatch-run-idcli/cli:babakks/retrieve-workflow-dispatch-run-idCopy head branch name to clipboard

Conversation

@babakks
Copy link
Member

@babakks babakks commented Feb 16, 2026

Fixes #12672

This PR adds a new feature detection method, ActionsFeatures that checks the API server's support for returning dispatched workflow run details.

Since it's a temporary situation, I've added // TODO workflowDispatchRunDetailsCleanup markers. They indicate the places (including test cases) that we should remove once the workflow run details are retrievable from supported host versions.

Also, those test cases that has nothing to do with the feature detection phase (e.g. checking for wrong inputs), are now set up with an enabled mock since that would be the default/common scenario, and this way we don't need to change them during the future cleanup.

Verification

In the screenshot, the first invocation is non-interactive and the second is interactive.

1. With run details on github.com

This will soon be the default behaviour for all github.com repos:

gh-workflow-run-new-look

Before this, gh would only exit with zero (see below images), but now we print out the created workflow run URL. This is backward compatible (since users would only rely on the exit code as that was the only indicator), and consistent with pr create or issue create experience.

2. Without run details on github.com

This is what users see if they run the updated gh workflow run now (i.e. the new API changes not published), and it's how the experience originally was.

gh-workflow-run-unchanged-dotcom

In this case, although the return_run_details field is set in the request (because the host is github.com), but the API server has ignored it and didn't return the run details. Here, gh works fine because regardless of the request fields, it'll still able to handle bot 200 or 204 responses.

3. Without run details on GHES v3.19 (i.e. <= v3.20)

This is what GHES users see, as GHES does not support the new API changes. This is unchanged, too.

gh-workflow-run-unchanged-ghes

In this case, due feature detection results, gh don't even set the return_run_details field.

…tch features

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Copilot AI review requested due to automatic review settings February 16, 2026 13:00
@babakks babakks requested a review from a team as a code owner February 16, 2026 13:00
@babakks babakks marked this pull request as draft February 16, 2026 13:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds feature detection and conditional behavior to gh workflow run so it can request and output workflow dispatch run details (URL/ID) on hosts that support it, while remaining compatible with older GHES versions that still return 204 No Content.

Changes:

  • Introduces ActionsFeatures feature detection to determine support for return_run_details on workflow dispatches.
  • Updates workflow run to include return_run_details: true when supported and to handle 200 responses with run details (printing URL/ID appropriately).
  • Expands/adjusts tests to cover both legacy (204) and new (200 + body) dispatch behaviors.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/cmd/workflow/run/run.go Adds detector plumbing, conditionally requests run details, and prints run URL/ID when returned.
pkg/cmd/workflow/run/run_test.go Adds stub variants and test cases for both 204 and 200 dispatch responses; updates expected output.
internal/featuredetection/feature_detection.go Adds ActionsFeatures and enterprise version gating for dispatch run details support.
internal/featuredetection/feature_detection_test.go Adds unit tests for ActionsFeatures across github.com, ghe.com, and GHES versions.
internal/featuredetection/detector_mock.go Extends detector mocks to implement ActionsFeatures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

internal/featuredetection/feature_detection.go Outdated Show resolved Hide resolved
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks babakks changed the title Babakks/retrieve workflow dispatch run feat(workflow run): retrieve workflow dispatch run details Feb 16, 2026
@babakks babakks marked this pull request as ready for review February 16, 2026 19:53
pkg/cmd/workflow/run/run.go Outdated Show resolved Hide resolved
pkg/cmd/workflow/run/run.go Outdated Show resolved Hide resolved
pkg/cmd/workflow/run/run.go Show resolved Hide resolved
babakks and others added 4 commits February 16, 2026 21:53
Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
…nges

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
pkg/cmd/workflow/run/run.go Outdated Show resolved Hide resolved
return ActionsFeatures{}, err
}

hostVersion, err := resolveEnterpriseVersion(d.httpClient, d.host)
Copy link
Member

Choose a reason for hiding this comment

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

Food For Thought

Out of scope for this but it feels like something we should be caching for a reasonable amount of time.

Copy link
Member Author

Choose a reason for hiding this comment

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

The HTTP client comes from the caller (e.g. the command) and we usually make them 24h-cached.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, right, yeah I forgot about all these things everywhere:

cachedClient := api.NewCachedHTTPClient(httpClient, time.Hour*24)

I wonder if this should just be baked into the feature detector. It's also idempotent.

Signed-off-by: Babak K. Shandiz <babakks@github.com>
Signed-off-by: Babak K. Shandiz <babakks@github.com>
@babakks babakks merged commit 027adc7 into trunk Feb 17, 2026
11 checks passed
@babakks babakks deleted the babakks/retrieve-workflow-dispatch-run-id branch February 17, 2026 20:37
joXemMx added a commit to sirius-ms/sirius-client-openAPI that referenced this pull request Feb 18, 2026
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.

workflow run: Output created workflow run ID

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.