I’m facing an issue with GitHub Actions where the workflow_dispatch
event trigger, combined with the pull_request
event, does not wait for manual actions and triggers automatically upon pull request opening.
Here’s a simplified version of my workflow configuration:
name: Manual Workflow on PR
on:
pull_request:
types:
- opened
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
#...
According to the GitHub Actions documentation, the workflow_dispatch
event should allow manual triggering of the workflow. However, in my case, the workflow always starts automatically when a new pull request is opened, regardless of manual triggering.
I have verified that the indentation of the workflow file is correct, and I have committed and pushed the latest version of the file to the repository. Despite these checks, the workflow fails to wait for manual interaction.
I would appreciate any insights or suggestions on why the workflow_dispatch
event is not waiting for manual actions and how to make it trigger manually as expected.
2
Answers
You have configured 2 conditions for action trigger
you can remove 1 so when any pull request open your workflow didn’t run automatically.
Workflows trigger according to the
on
configuration, if ANY of the informed condition is met.Documentation: Events that trigger workflows
In your case with the following configuration:
You are actually allowing the workflow to trigger if one of two conditions is met:
A Pull Request is opened: Reference
The workflow is triggered manually (through the GitHub API, GitHub UI or Github CLI): Reference
If you just want to trigger the workflow manually, you should only keep the
workflow_dispatch
configuration:For more informations, you can also check how to manually trigger workflows on the documentation.
Note that there is also a manual approval for deployments configuration for GitHub Actions, which requires a reviewer approval during a workflow run to continue its process.