Skip to content

API: /actions/runs returns event: "push" for scheduled workflow runs #37252

@raychinov

Description

@raychinov

Description

The /api/v1/repos/{owner}/{repo}/actions/runs endpoint returns event: "push" for runs triggered by a schedule: (cron). Inside the workflow, gitea.event_name correctly returns "schedule" (fix from #27667). Filtering event == "schedule" via the API makes scheduled runs appear indistinguishable from push events.

This is asymmetric: the tasks/jobs API correctly uses run.TriggerEvent.

Root cause

ActionRun has two event fields:

The two API converters disagree:

Bug is also present on main (same line numbers).

Reproduction

  1. Create a repo with .gitea/workflows/cron.yml:
    on:
      schedule:
        - cron: "* * * * *"
    jobs:
      tick:
        runs-on: ubuntu-latest
        steps:
          - run: echo "fired by ${{ gitea.event_name }}"
  2. Wait one minute for the cron to fire.
  3. GET /api/v1/repos/{owner}/{repo}/actions/runs?limit=1 → returns event: "push" with trigger_actor.login: "gitea-actions".
  4. Inside the job, gitea.event_name prints schedule — consistent with gitea.event_name set to push when running scheduled #27667 fix.

Suggested fix

Change convert.go:263 to match the tasks converter:

Event: run.TriggerEvent,

Gitea Version

1.25.5 (bug also verified on main)

Can you reproduce the bug on the Gitea demo site?

No (not tested, but bug is source-verified on both v1.25.5 and main)

How are you running Gitea?

Docker (gitea/gitea:1.25.5 official image).

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/apiConcerns mainly the API

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions