WorkflowDispatch api optionally return runid#36706
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements the GitHub workflow dispatch API feature that optionally returns run details (workflow run ID and URLs) when dispatching a workflow. This matches the GitHub API behavior announced in their February 2026 changelog. The implementation adds an optional return_run_details query parameter that, when set to true, returns a 200 OK response with run details instead of the default 204 No Content response.
Changes:
- Modified
DispatchActionWorkflowservice function to return the created workflow run ID - Updated API endpoint to optionally return run details based on
return_run_detailsquery parameter - Added
RunDetailsstruct to define the response format with workflow run ID and URLs - Added comprehensive test coverage for the new functionality
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| services/actions/workflow.go | Changed DispatchActionWorkflow to return (runID int64, workflowError error) instead of just error, updating all error returns to include a 0 runID |
| routers/api/v1/repo/action.go | Added conditional response logic: returns 204 No Content by default, or 200 OK with run details when return_run_details=true |
| routers/web/repo/actions/view.go | Updated caller to handle the new return signature by ignoring the returned runID |
| modules/structs/repo_actions.go | Added RunDetails struct containing WorkflowRunID, RunURL, and HTMLURL fields |
| routers/api/v1/swagger/action.go | Added Swagger response definition for RunDetails |
| templates/swagger/v1_json.tmpl | Updated Swagger documentation with new query parameter and response definitions |
| tests/integration/actions_trigger_test.go | Added test case to verify the new functionality works correctly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Comment written by Claude (AI assistant) on behalf of @silverwind Nice feature! A few observations: Consider reusing The codebase already has
Field naming diverges from existing patterns The new Minor: named return value The |
Note, adding more fields is ok for me. However not following the GitHub Docs not. So I generally disagree to these points of claude
I saw wxiaoguang using an anonymous struct with named fields, not sure if this is a better pattern. |
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Changed it to Sometimes I use "anonymous struct" when the returned values are too many (more than 2 or 3) |
|
Thanks. Sounds good, to give the error the discard identifier, since this is self explaining if not used. Never thought about this. |
* giteaofficial/main: (21 commits) Enable docker layer caching for `dry-run` and `nightly` container builds (go-gitea#36738) Add admin badge to navbar avatar (go-gitea#36790) WorkflowDispatch api optionally return runid (go-gitea#36706) upgrade minimatch (go-gitea#36760) Add `never` option to `PUBLIC_URL_DETECTION` configuration (go-gitea#36785) Refactor avatar package, support default avatar fallback (go-gitea#36788) Mark unused&immature activitypub as "not implemented" (go-gitea#36789) Add “Copy Source” to markup comment menu (go-gitea#36726) Update Nix flake (go-gitea#36787) Implements OIDC RP-Initiated Logout (go-gitea#36724) Fix README symlink resolution in subdirectories like .github (go-gitea#36775) [skip ci] Updated translations via Crowdin Correct spelling (go-gitea#36783) refactor: replace legacy tw-flex utility classes with flex-text-block/inline (go-gitea#36778) Fix `no-content` message not rendering after comment edit (go-gitea#36733) Fix typos and grammar in English locale (go-gitea#36751) Move Fomantic dropdown CSS to custom module (go-gitea#36530) Use "Enable Gravatar" but not "Disable" (go-gitea#36771) feat: add branch_count to repository API (go-gitea#35351) (go-gitea#36743) Deprecate RenderWithErr (go-gitea#36769) ...

Implements https://github.blog/changelog/2026-02-19-workflow-dispatch-api-now-returns-run-ids