I am just experimenting with GitHub action and I have the following workflow.
feature/ticketno
), I would like to run some tests against the newly created PR branch.one solution I found is to add an if condition in the action steps to avoid running tests against the desired branches on the PR up(ie master, staging).
But not sure this is the right approach I looking for a proper solution
Github actions supports triggering a build when a pull request is created pointing to a specified branch or on a push to a wildcard branch. Your scenario would require custom conditions. You might find a good compromise by using branches-ignore
and types
here's an example of a wildcard feature branches, push vs pull_request trigger
on:
push:
branches:
- main
- dev
- feature/*
pull_request:
branches:
- main
- dev
Also check this Q&A GitHub actions to trigger build on new Pull Requests
For reference and all available options https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions