Skip to content

When a workflow is triggered by schedule, the value of gitea.event_name in run-name is empty #36872

@imkuang

Description

@imkuang

Description

Hello,

As stated in the title, I tested push, schedule, and workflow_dispatch triggers with the following workflow:

name: test
run-name: ${{ format('test ({0})', gitea.event_name) }}

on:
  schedule:
    - cron: "*/2 * * * *"
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6

The results are as follows, when triggered by schedule, gitea.event_name is empty

Image

I have do some simple analysis, and it might be caused by the fact that the ActionRun object generated by the ToActionRun function (introduced in #34301) does not set the TriggerEvent field. In theory, explicitly setting it to webhook_module.HookEventSchedule should work.
https://github.com/go-gitea/gitea/blob/main/models/actions/utils.go#L87

I'm not familiar with Golang and Gitea's implementation, and I currently lack a Golang development environment and enough time, so I'm merely raising the issue and a possible reason. If someone could fix it, it would be greatly appreciated.

Gitea Version

1.25.4

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Docker

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions