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

Run actions on Pull Requests with merge conflicts

We have a suite of actions which allows us to build and deploy mobile apps archives from pull requests, which we use as a part of our release process and planned to use for feature development.

 

Workflow has been configured like this:

 

on:
  pull_request:
    types: [labeled]


jobs:
my-deploy-job:
if: startsWith(github.head_ref, 'release/') && github.event.label.name == 'deploy_ios'
steps:
- ...

 

 

We have recently started to encounter problems, that actions do not start at all, if PR has any conflicts with a base branch. This is a rather interesting limitation for our use case, our current gitflow assumes possible existance of merge conflict between release/ and master branches (we cherry pick hotfixes), where in the end we would occasionally override master branch with changes from release with strategy-option (this happens because of previous release hotfixes having different parent commits).

 

For feature branches it's also rather an undesired behaviour, since if I want to share a test build with my colleagues (designer, pm) to test, we don't really care whether I'm up to date with base branch. 

 

In fact checkout action already allows to disable merging into base, which we use, but it doesn't really work if you workflow doesn't get trigged at all.

    steps:
      - uses: actions/checkout@v1
        with:
          ref: ${{ github.head_ref }}

 

There have been some other related threads, which didn't got much attention in the end:

https://github.community/t5/GitHub-Actions/Support-pull-request-events-without-merge-commit-into-the...

https://github.com/actions/checkout/issues/15

 

Suggested approach with using on: push, doesn't really work with labels. We know for sure that we can work it out with on: issue_comment, but it's cumbersome and requires an extra API call to get PR context.

 

What would be really nice is an option in repo settings to allow run actions with merge conflicts. Or if there's any alternative solution to configure a workflow run without looking at a conflicts and ideally with a context of a PR, would be great to know.

 

Thank you!

1 Reply
GitHub Partner
Message 2 of 2

Re: Run actions on Pull Requests with merge conflicts

Thank you for reaching out! It’s a limitation that workflow is not triggered for ‘pull_request’ event if conflicts exist.

BTW,  please set ‘if’ expression at step level and ‘startswith()’ doesn’t accept variables, please use code sample as below:

    steps:
      - if: github.head_ref == 'release' && github.event.label.name == 'deploy_ios'
        uses: actions/checkout@v1