Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 6

Actions Reporting Wrong Branch on Merges

I'm having issues where my actions are firing on the correct branches (based on the filters/triggers in their `yaml` files) but are showing the incorrect branch as the source

This gave me concern initially when my feature/bug branches were firing off staging deploys, and my develop/master branches were running quality checks meant for feature/bug branches.

When I dug into it, it seems to be tied to merges.  If I merge develop into a feature branch and make a push to the feature branch, actions will report the branch that activated the action as "develop".  And if I merge a feature branch into develop, the action will report being triggered by "feature/name-goes-here".

It might be a small edge case, but it effects filtering as well.  Is this a known issue, or should I be doing something to work around this?

You can see it below, the first commit was done directly into develop, and the second triggered when I merged that commit into my feature branch and pushed it

CI-Quality only runs on feature branches, and deploy staging only runs on develop, but both report being generated by develop
ghub.png

5 Replies
GitHub Partner
Message 2 of 6

Re: Actions Reporting Wrong Branch on Merges

Can you share your CI-Quality and deploy-staging workflow yml file here? According to your screenshot, these two workflows are triggered by the same commit. Can you share us how do you make CI-Quality only run on feature branches, and deploy staging only runs on develop?   

Copilot Lvl 2
Message 3 of 6

Re: Actions Reporting Wrong Branch on Merges

CI Quality Workflow

name: CI-Quality

on:
  push:
    branches:
      - '!master'
      - '!develop'
      - '**/*'

jobs:
  quality:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - uses: sergioramos/yarn-actions/install@master
        with:
          frozen-lockfile: true
      - name: Setup
        run: yarn global add @angular/cli
      - name: Lint
        run: npm run lint
      - name: Test
        run: npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
      - name: Build
        run: npm run build


deploy-staging workflow

name: deploy-staging

on:
  push:
    branches:
      - 'develop'

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v1
      - name: Install Node.js
        uses: actions/setup-node@v1
        with:
          node-version: '10.x'
      - name: install packages
        uses: sergioramos/yarn-actions/install@master
        with:
          frozen-lockfile: true
      - name: Setup NG-CLI
        run: yarn global add @angular/cli
      - name: Build App
        run: npm run build --prod
      - name: Deploy to Server
        uses: easingthemes/ssh-deploy@v2.0.7
        env:
          SSH_PRIVATE_KEY: ${{ secrets.CI_SSH_KEY }}
          ARGS: '-rltgoDzvO --delete'
          SOURCE: 'dist/browser/'
          REMOTE_HOST: ${{ secrets.HOST }}
          REMOTE_USER: ${{ secrets.CI_USER }}
          TARGET: ${{ secrets.STAGING_TARGET }}
Ground Controller Lvl 1
Message 4 of 6

Re: Actions Reporting Wrong Branch on Merges

Any follow up on this? The action performs as expected but reports the incorrect branch in the UI, which is confusing at the least.

GitHub Partner
Message 5 of 6

Re: Actions Reporting Wrong Branch on Merges

Sorry for the delay response. 

When the branch being merged is a direct descendant of the branch merged into, git simply fast forwards the head pointer, and no merge commit is created. 

merge ff.png

Fast-forward marge will lead to workflow run shows wrong branch . This is an known issue. We have reported it to  the appropriate engineering team.

Does this match your scenario?  

Copilot Lvl 3
Message 6 of 6

Re: Actions Reporting Wrong Branch on Merges

Sounds like the same issue I reported months ago... Slightly disconcerting that this still hasn't been addressed/fixed... https://github.community/t5/GitHub-Actions/Wrong-branch-displayed-for-workflow/m-p/37985#M3178