0

I have a repo with multiple branches on GitHub. CI is enabled with GitHub Actions. The idea is to run the jobs in action whenever development branch is updated(push or merge into development branch). Note that development branch is not the default branch. And I want each step in the job or the entire job itself to run only on development branch. The following is my GitHub action workflow yaml file:

name: TARegistry3UI CI

on:
  push:
    branches: 
      - development
  pull_request:
    branches: 
      - development
  workflow_dispatch:

jobs:
  development-build-deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: build
      run: |
       docker network create shared
       docker-compose up --build -d
    - name: 'Deploy to Azure WebApp'
      uses: azure/webapps-deploy@v2
      with: 
        publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
adityabhuvanraj
  • 25
  • 1
  • 13
  • What is the issue you're having? The triggers you have specified should do what you want. – Cesar Dec 16 '21 at 10:47
  • The issue is that the deployed app is not reflecting the latest changes made to that development branch. So I'm thinking maybe the steps in job are either running on the default branch or the master branch. – adityabhuvanraj Dec 16 '21 at 11:24
  • Remove the `pull_request` and `workflow_dispatch` trigger. The former runs this workflow on pull requests against the `development` branch and the latter allows a user to run the workflow on any branch (manually). – rethab Dec 16 '21 at 13:07
  • I'm using 'workflow_dispatch' to manually run the workflows during development, but my understanding to use 'pull_request' was to ensure the workflow ran when any other branch was merged into the development branch. @rethab – adityabhuvanraj Dec 16 '21 at 13:15
  • pull_request triggers whenever a pull_request is created towards the development branch, -not- when merged push triggers when anything is merged into the development branch – Cesar Dec 16 '21 at 13:51
  • So just push will do in my case? But how does that still explain the latest code on development not being deployed to azure app service? – adityabhuvanraj Dec 16 '21 at 14:47
  • yes, just push will do. also, there's a log of all actions run so you should see if something was triggered that you did not expect. – rethab Dec 16 '21 at 15:29
  • can you please guide to me how to find these log files. – adityabhuvanraj Dec 16 '21 at 16:01
  • Does this answer your question? [Only run job on specific branch with GitHub Actions](https://stackoverflow.com/questions/58139406/only-run-job-on-specific-branch-with-github-actions) – Bergi Feb 09 '23 at 02:26

0 Answers0