go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.33k stars 5.43k forks source link

Multiple Triggers Are Not Working in Combination With Workflow Dispatch #32142

Open Drophoff opened 2 days ago

Drophoff commented 2 days ago

Short Description: If a pipeline contains the trigger “workflow_dispatch” and "push", the pipeline is not executed for push events.

Expected behavior: I would expect the pipline to be executed for both events. For a simple push as well as a manual execution.

Incorrect behavior: The pipeline does not react to push-trigger.

Current behavior: Only the manual execution works.

Reproduction: The following example contains two triggers. On the one hand the new “workflow_dispatch” as well as a simple "push". With this definition only the manual execution works. The pipeline is not executed during a push.

name: default

on:
  workflow_dispatch:
    inputs:
      profile:
        description: 'The environment in which the application is to be installed.'
        required: true
        type: choice
        options:
        - dev
        - sys
        - prod
  push:

env:
    PROFILE: dev

jobs:
  compile:
    runs-on: ubuntu-latest
    steps:
      - name: preparation
        id: evaluate
        run: |
          if [ "$GITHUB_EVENT_NAME" = "workflow_dispatch" ]; then
            export USE_ENVIRONMENT=${{ inputs.profile }}
          else
            export USE_ENVIRONMENT=${{ env.PROFILE }}
          fi
          echo "Determined Environment: $USE_ENVIRONMENT"

Workaround: Two independent workflows can be created as a workaround. The first deals with the “workflow_dispatch” and the second with the "push" event. The common logic is outsourced to a "workflow_call" and used by the previous workflows.

Gitea Version

1.23.0+dev-526-g3269b04d61

Can you reproduce the bug on the Gitea demo site?

No, because there are no runners available.

Log Gist

No response

Screenshots

No response

Git Version

2.30.2

Operating System

Debian 10.7

How are you running Gitea?

Gitea is running with two act_runners and an act_runner cache within Docker on a Debian system.

Database

SQLite

lunny commented 2 days ago

I created a pull request to allow parse workflow_dispatch in act fork project. https://gitea.com/gitea/act/pulls/118

Drophoff commented 18 hours ago

That's great news! Thank you so much for the quick turnaround and helpful feedback!