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.
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:
on:
pull_request:
types:
- opened
workflow_dispatch:
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:
on:
workflow_dispatch:
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.