How can I trigger a job in Ansible Tower using its API on a Github branch commit?
I could use a Github webhook but when triggered by a push it occurs regardless of branch. I'm wondering if the webhook payload could provide info but I m not sure how to utilize it within the job. Am I on the right track or is there a better approach?
Thanks.
You could use a pipeline using GitHub actions and conditionals. For example:
on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- main
pull_request:
branches:
- main
Taken from here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With