An Interest In:
Web News this Week
- March 21, 2024
- March 20, 2024
- March 19, 2024
- March 18, 2024
- March 17, 2024
- March 16, 2024
- March 15, 2024
Running GitHub Actions CI/CD triggers on specific branches
GitHub Actions allows you to automate, customize, and execute your software development workflows inside your repository.
You can configure your workflows to run when specific activity on GitHub happens, at a scheduled time, or when an event outside of GitHub occurs.
The most common events are push and pull_request events. By default, the below workflow will run on any push to any branch and for every pull request opened.
on: [push, pull_request]
If you would like certain events to run on specific branches. You can adjust the YAML to include branch names to only run CI checks on branches you needed them. Below I have changed my events to run on the main branch, even though it is named the push. It will run when you run git push or merge a pull request into the main branch.
on: push: branches: - main pull_request: branches: - main
Finally, you can leverage YAML syntax to run an array of branches. You can also set up wildcards to run on similarly named branches as well.
So now you can set up a workflow to run in multiple branches and maintain separate release tracks. For example:
on: push: branches: - main - 'releases/**' pull_request: branches: - main - 'releases/**'
Learn more GitHub Actions tips in our Community Support Forums.
This is part of my 28 days of Actions series. To get notified of more GitHub Action tips, follow the GitHub organization right here on Dev.
Original Link: https://dev.to/github/running-github-actions-ci-cd-triggers-on-specific-branches-5e6m
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To