What's the best way to specify workflow triggers?

Our favorite way to specify workflow triggers is to just name the prompt file after the event that will trigger the workflow. For example, if you have a workflow that runs when a PR is opened, you could name the prompt file pr-opened.txt.

For more complex workflows or triggers with multiple conditions, you can specify the triggers in the prompt file. For example, if you have a workflow that runs when a PR is opened or when a commit is pushed, you could name the prompt file pr-or-commit.txt. Another example is if you have a workflow that runs when a PR is opened or when a commit is pushed and the PR title contains feature, you could name the prompt file pr-or-commit.txt and include the title condition in the prompt.

Examples

Using a structured format:

triggers:
- when a pull request is created

Or using natural language:

Run this workflow when a pull request is created and the title contains "feature"

Discussion

Clear trigger definitions help AutoCI:

  • Create more accurate workflows
  • Set up the correct event listeners
  • Configure appropriate conditions and filters
  • Optimize the workflow execution timing