How to run different Github Actions for the different git branches

ismail yenigül
1 min readJun 11, 2020

--

You can create different .yml files under the repo/.github/workflows directory for each different branch you want to enable github actions.

When you want to setup a new workflow(ie AWS ECS action), it creates an aws.yml file. But you don’t have to use that name to make it work. You can give any name to identify it better.

I wanted to enable github actions on staging and develop branches. To do it

created .github/workflows/develop-aws.yml in develop branch and set branches to develop

on:
# Trigger the workflow on push or pull request
push:
branches:
- develop

and switched to staging branch and created .github/workflows/staging-aws.yml and set branches to staging

on:
# Trigger the workflow on push or pull request
push:
branches:
- staging

Ismail YENIGUL

--

--

ismail yenigül
ismail yenigül

Written by ismail yenigül

CKA/CKAD,AWS certified Freelancer DevOps Engineer

Responses (1)