Detect manual trigger

How can I detect if a workflow has been manually triggered for Bitbucket in my config.yml?
I would expect to be able to differentiate between commits and manual triggers using pipeline.trigger_source (Pipeline values and parameters - CircleCI), but the value of this is always ‘webhook’ both for commit triggers and manual triggers from the UI.

For gitlab there is pipeline.trigger_parameters.circleci.event_type, but for Bitbucket that doesn’t exist.

Context:
We run certain jobs in our workflows bases on which directories changed in the repo. So manually triggering such workflow won’t run those jobs as the repo didn’t change. So we want to detect if the workflow was triggered from the UI, so we can overrule this directory change check.

Hey @reinhardhameeteman - we have a Support article created around viewing / debugging Bitbucket Webhooks that might be helpful?

Let me know, and I’ll see what else I can find for you!

Hi @reinhardhameeteman!

Thanks for making your first post to our Discuss platform!

To see the trigger type, you can utilize our getPipelineByNumber API endpoint.
This, mixed with a little bit of jq can give you the trigger source on the fly.

curl --request GET \
  --url https://circleci.com/api/v2/project/<project_slug>/pipeline/<build_num> \
  --header "Circle-Token: $CIRCLE_TOKEN" | jq .trigger.type

However, if you are using - run: echo << pipeline.trigger_source >>, this should be returning the correct trigger type whether it was from a webhook or from an API trigger such as our Trigger Pipeline button or via our API endpoint.

If you have some examples of this not working correctly, can you please submit a support ticket so that our team can look further into it? A video of you clicking the Trigger Pipeline button and then calling that API endpoint for the trigger.type would be most beneficial.