fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs#37288
Conversation
…s instead of push
|
To make it more clear should we publish both via api? |
yes i think we should as it will eventually help consumers get more context. |
|
and maybe also have a look how github behaves here - especially for api its good to have nearly the same |
ok i will look into it. |
|
Two minor items worth addressing:
This comment was written by Claude Opus 4.7. |
Github only exposes event field( actual event that triggered the run ) |
Did you address them? |
|
@silverwind addressed your requests |
* main: (25 commits) Add URL to `Learn more about blocking a user` (go-gitea#37355) fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs (go-gitea#37288) Add event.schedule context for schedule actions task (go-gitea#37320) Fix typos (go-gitea#37346) Fix an issue where changing an organization’s visibility caused problems when users had forked its repositories. (go-gitea#37324) Fail vite build on rolldown warnings via NODE_ENV=test (go-gitea#37270) Use modern "git update-index --cacheinfo" syntax to support more file names (go-gitea#37338) Fix URL related escaping for oauth2 (go-gitea#37334) When the requested arch rpm is missing fall back to noarch (go-gitea#37236) Fix `relative-time` error and improve global error handler (go-gitea#37241) Enhance styling in actions page (go-gitea#37323) fix(oauth): Error on auth sources with spaces (go-gitea#37327) Fix actions concurrency groups cross-branch leak (go-gitea#37311) Fix bug when accessing user badges (go-gitea#37321) Fix AppFullLink (go-gitea#37325) Update go js dependencies (go-gitea#37312) Update GitHub Actions to latest major versions (go-gitea#37313) Revert "Add WebKit to e2e test matrix (go-gitea#37298)" (go-gitea#37315) Add `form-fetch-action` to some forms, fix "fetch action" resp bug (go-gitea#37305) Move heatmap to first-party code (go-gitea#37262) ...
…for scheduled runs (#37288) (#37360) Backport #37288 by @KalashThakare ## Summary Fixes #37252 The `/api/v1/repos/{owner}/{repo}/actions/runs` endpoint was returning `event: "push"` for workflow runs triggered by `schedule:` (cron), instead of `event: "schedule"`. ## Root Cause `ActionRun` has two separate fields: - `Event` — the workflow registration event (e.g. `push`, set when the workflow file was first pushed) - `TriggerEvent` — the actual event that triggered the run (e.g. `schedule`) `ToActionWorkflowRun` in `services/convert/action.go` was serializing `run.Event` into the API response instead of `run.TriggerEvent`, causing scheduled runs to be indistinguishable from push events via the API. This was already asymmetric — the tasks/jobs API correctly used `TriggerEvent`. ## Fix Changed `ToActionWorkflowRun` to use `run.TriggerEvent` for the `event` field in the API response, consistent with how the jobs API works. ## Before `event: "push"` returned for all scheduled runs: <img width="1112" height="191" alt="Screenshot 2026-04-19 115642" src="https://github.com/user-attachments/assets/c0a169f5-bbd9-4f5d-9474-e4c3795110e4" /> ## After `event: "schedule"` correctly returned for scheduled runs: <img width="890" height="166" alt="Screenshot 2026-04-19 121723" src="https://github.com/user-attachments/assets/860e99ac-0935-4a43-86a1-7b60f8113480" /> ## Testing - Added unit test `TestToActionWorkflowRun_UsesTriggerEvent` in `services/convert/action_test.go` that explicitly verifies the API returns `TriggerEvent` and not `Event` for a scheduled run. - Manually verified via the API against a live Gitea instance with a `cron: "* * * * *"` workflow. Co-authored-by: Kalash Thakare ☯︎ <kalashthakare898@gmail.com> Co-authored-by: Nicolas <bircni@icloud.com>
* origin/main: (32 commits) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) Fix cmd tests by mocking builtin paths (go-gitea#37369) chore: upgrade Go version in devcontainer image to 1.26 (go-gitea#37374) Fix button layout shift when collapsing file tree in editor (go-gitea#37363) Update `Block a user` form (go-gitea#37359) Remove IsValidExternalURL/IsAPIURL and use IsValidURL at call sites (go-gitea#37364) Add URL to `Learn more about blocking a user` (go-gitea#37355) fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs (go-gitea#37288) Add event.schedule context for schedule actions task (go-gitea#37320) Fix typos (go-gitea#37346) Fix an issue where changing an organization’s visibility caused problems when users had forked its repositories. (go-gitea#37324) Fail vite build on rolldown warnings via NODE_ENV=test (go-gitea#37270) Use modern "git update-index --cacheinfo" syntax to support more file names (go-gitea#37338) Fix URL related escaping for oauth2 (go-gitea#37334) When the requested arch rpm is missing fall back to noarch (go-gitea#37236) Fix `relative-time` error and improve global error handler (go-gitea#37241) Enhance styling in actions page (go-gitea#37323) fix(oauth): Error on auth sources with spaces (go-gitea#37327) Fix actions concurrency groups cross-branch leak (go-gitea#37311) ... # Conflicts: # services/actions/commit_status.go
* origin/main: (204 commits) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) Fix cmd tests by mocking builtin paths (go-gitea#37369) chore: upgrade Go version in devcontainer image to 1.26 (go-gitea#37374) Fix button layout shift when collapsing file tree in editor (go-gitea#37363) Update `Block a user` form (go-gitea#37359) Remove IsValidExternalURL/IsAPIURL and use IsValidURL at call sites (go-gitea#37364) Add URL to `Learn more about blocking a user` (go-gitea#37355) fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs (go-gitea#37288) Add event.schedule context for schedule actions task (go-gitea#37320) Fix typos (go-gitea#37346) Fix an issue where changing an organization’s visibility caused problems when users had forked its repositories. (go-gitea#37324) Fail vite build on rolldown warnings via NODE_ENV=test (go-gitea#37270) Use modern "git update-index --cacheinfo" syntax to support more file names (go-gitea#37338) Fix URL related escaping for oauth2 (go-gitea#37334) When the requested arch rpm is missing fall back to noarch (go-gitea#37236) Fix `relative-time` error and improve global error handler (go-gitea#37241) Enhance styling in actions page (go-gitea#37323) fix(oauth): Error on auth sources with spaces (go-gitea#37327) Fix actions concurrency groups cross-branch leak (go-gitea#37311) ... # Conflicts: # web_src/js/index-domready.ts # web_src/js/markup/content.ts # web_src/js/markup/refissue.ts
* origin/main: (204 commits) fix: commit status reporting (go-gitea#37372) Support for Custom URI Schemes in OAuth2 Redirect URIs (go-gitea#37356) Fix cmd tests by mocking builtin paths (go-gitea#37369) chore: upgrade Go version in devcontainer image to 1.26 (go-gitea#37374) Fix button layout shift when collapsing file tree in editor (go-gitea#37363) Update `Block a user` form (go-gitea#37359) Remove IsValidExternalURL/IsAPIURL and use IsValidURL at call sites (go-gitea#37364) Add URL to `Learn more about blocking a user` (go-gitea#37355) fix: use TriggerEvent instead of Event in workflow runs API response for scheduled runs (go-gitea#37288) Add event.schedule context for schedule actions task (go-gitea#37320) Fix typos (go-gitea#37346) Fix an issue where changing an organization’s visibility caused problems when users had forked its repositories. (go-gitea#37324) Fail vite build on rolldown warnings via NODE_ENV=test (go-gitea#37270) Use modern "git update-index --cacheinfo" syntax to support more file names (go-gitea#37338) Fix URL related escaping for oauth2 (go-gitea#37334) When the requested arch rpm is missing fall back to noarch (go-gitea#37236) Fix `relative-time` error and improve global error handler (go-gitea#37241) Enhance styling in actions page (go-gitea#37323) fix(oauth): Error on auth sources with spaces (go-gitea#37327) Fix actions concurrency groups cross-branch leak (go-gitea#37311) ... Co-Authored-By: Claude (Opus 4.7) <noreply@anthropic.com> # Conflicts: # web_src/js/index-domready.ts # web_src/js/markup/content.ts # web_src/js/markup/refissue.ts
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [docker.gitea.com/gitea](https://github.com/go-gitea/gitea) | service | patch | `1.26.0` → `1.26.1` | --- ### Release Notes <details> <summary>go-gitea/gitea (docker.gitea.com/gitea)</summary> ### [`v1.26.1`](https://github.com/go-gitea/gitea/releases/tag/v1.26.1) [Compare Source](go-gitea/gitea@v1.26.0...v1.26.1) - BUGFIXES \* Add event.schedule context for schedule actions task ([#​37320](go-gitea/gitea#37320)) ([#​37348](go-gitea/gitea#37348)) \* Fix an issue where changing an organization's visibility caused problems when users had forked its repositories. ([#​37324](go-gitea/gitea#37324)) ([#​37344](go-gitea/gitea#37344)) \* Use modern "git update-index --cacheinfo" syntax to support more file names ([#​37338](go-gitea/gitea#37338)) ([#​37343](go-gitea/gitea#37343)) \* Fix URL related escaping for oauth2 ([#​37334](go-gitea/gitea#37334)) ([#​37340](go-gitea/gitea#37340)) \* When the requested arch rpm is missing fall back to noarch ([#​37236](go-gitea/gitea#37236)) ([#​37339](go-gitea/gitea#37339)) \* Fix actions concurrency groups cross-branch leak ([#​37311](go-gitea/gitea#37311)) ([#​37331](go-gitea/gitea#37331)) \* Fix bug when accessing user badges ([#​37321](go-gitea/gitea#37321)) ([#​37329](go-gitea/gitea#37329)) \* Fix AppFullLink ([#​37325](go-gitea/gitea#37325)) ([#​37328](go-gitea/gitea#37328)) \* Fix container auth for public instance ([#​37290](go-gitea/gitea#37290)) ([#​37294](go-gitea/gitea#37294)) \* Enhance GetActionWorkflow to support fallback references ([#​37189](go-gitea/gitea#37189)) ([#​37283](go-gitea/gitea#37283)) \* Fix vite manifest update masking build errors ([#​37279](go-gitea/gitea#37279)) ([#​37310](go-gitea/gitea#37310)) \* Fix Mermaid diagrams failing when node labels contain line breaks ([#​37296](go-gitea/gitea#37296)) ([#​37299](go-gitea/gitea#37299)) \* Use TriggerEvent instead of Event in workflow runs API response for scheduled runs ([#​37288](go-gitea/gitea#37288)) [#​37360](go-gitea/gitea#37360) \* Add URL to Learn more about blocking a user. ([#​37355](go-gitea/gitea#37355)) [#​37367](go-gitea/gitea#37367) \* Fix button layout shift when collapsing file tree in editor ([#​37363](go-gitea/gitea#37363)) [#​37375](go-gitea/gitea#37375) \* Fix org team assignee/reviewer lookups for team member permissions ([#​37365](go-gitea/gitea#37365)) [#​37391](go-gitea/gitea#37391) \* Fix repo init README EOL ([#​37388](go-gitea/gitea#37388)) [#​37399](go-gitea/gitea#37399) \* Fix: dump with default zip type produces uncompressed zip ([#​37401](https://github.com/go-gitea/gitea/issues/37401))[#​37402](https://github.com/go-gitea/gitea/issues/37402) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xNDAuMCIsInVwZGF0ZWRJblZlciI6IjQzLjE0MC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119--> Reviewed-on: https://gitea.com/gitea/tea/pulls/968 Co-authored-by: Renovate Bot <renovate-bot@gitea.com> Co-committed-by: Renovate Bot <renovate-bot@gitea.com>
Summary
Fixes #37252
The
/api/v1/repos/{owner}/{repo}/actions/runsendpoint was returningevent: "push"for workflow runs triggered byschedule:(cron), insteadof
event: "schedule".Root Cause
ActionRunhas two separate fields:Event— the workflow registration event (e.g.push, set when the workflow file was first pushed)TriggerEvent— the actual event that triggered the run (e.g.schedule)ToActionWorkflowRuninservices/convert/action.gowas serializingrun.Eventinto the API response instead ofrun.TriggerEvent, causingscheduled runs to be indistinguishable from push events via the API.
This was already asymmetric — the tasks/jobs API correctly used
TriggerEvent.Fix
Changed
ToActionWorkflowRunto userun.TriggerEventfor theeventfield in the API response, consistent with how the jobs API works.
Before
event: "push"returned for all scheduled runs:After
event: "schedule"correctly returned for scheduled runs:Testing
TestToActionWorkflowRun_UsesTriggerEventinservices/convert/action_test.gothat explicitly verifies the APIreturns
TriggerEventand notEventfor a scheduled run.cron: "* * * * *"workflow.