Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Drophoff opened this issue Sep 26, 2024 · 5 comments · Fixed by #32200
Closed

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

Drophoff opened this issue Sep 26, 2024 · 5 comments · Fixed by #32200
Labels
topic/gitea-actions related to the actions of Gitea type/bug

Comments

@Drophoff
Copy link

Drophoff commented Sep 26, 2024

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

@kemzeb kemzeb added the topic/gitea-actions related to the actions of Gitea label Sep 26, 2024
@lunny
Copy link
Member

lunny commented Sep 26, 2024

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

@Drophoff
Copy link
Author

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

@pankajmyt
Copy link

pankajmyt commented Oct 10, 2024

Just got gitea 1.22.3, above issue is still there.

  1. pushing to a branch other than main branch

@lunny
Copy link
Member

lunny commented Oct 10, 2024

I cannot reproduce it. Can you post your workflow file?

@pankajmyt
Copy link

pankajmyt commented Oct 12, 2024

This is the head of the file

While pushing on branch release/testenv1 it push action does not run.
workflow dispatch section is also not visible. gitea -> build.yaml file has been committed in default branch release/production

Gitea Version
1.22.3 built with GNU Make 4.3, go1.23.2 : bindata, sqlite, sqlite_unlock_notify, pam, cert

name: Articles build & deploy
run-name: Deploy to GCP Cloud ${{ gitea.actor }}
on:
  push:
    branches:
      - "release/production"
      - "release/testenv1"
      - "release/testenv2"
      - "release/testenv3"
      - "release/testenv4"
  workflow_dispatch:
    inputs:
      environment:
        description: "Environment to run tests against"
        type: environment
        required: true
        default: "environment value"

env:
  SERVICE_NAME: ${{ fromJson(vars.branch_service_mapping)[gitea.ref_name] }}
  ENVIRONMENT: ${{ contains(fromJSON('["staging", "production"]'), inputs.environment) && inputs.environment || (contains(gitea.ref_name, 'production') && 'production' || 'staging') }}
  
defaults:
  run:
    shell: bash

jobs:
  deploy:
    runs-on: ubuntu-22.04
    steps: ...

@go-gitea go-gitea locked as resolved and limited conversation to collaborators Jan 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants