Open jgonggrijp opened 3 years ago
Hello @jgonggrijp, thanks for the issue.
I have done some tests, the event never fires the workflow, it seems that the labeled event in a pull request does not allow filtering branches. Without the branch filter should be work.
Example:
name: Prepublication staging
on:
pull_request:
types: [labeled]
# branches:
# - release/*
# - hotfix/*
jobs:
stage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Merge into prepublish
uses: devmasx/merge-branch@v1.3.1
with:
label_name: ready to launch
target_branch: prepublish
github_token: ${{ secrets.GITHUB_TOKEN }}
I will try to investigate a little more because it does not work with the branch filter, However, using conditions in the job should be work.
Example:
name: Prepublication staging
on:
pull_request:
types: [labeled]
jobs:
stage:
if: contains(github.ref, 'refs/release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Merge into prepublish
uses: devmasx/merge-branch@v1.3.1
with:
label_name: ready to launch
target_branch: prepublish
github_token: ${{ secrets.GITHUB_TOKEN }}
Thanks for taking up on this @MiguelSavignano! I adopted your helpful suggestion to use if
instead of a branch filter. I now get one step further: the workflow is triggered, but then the job is immediately skipped. Unfortunately, that page doesn't mention why the job is skipped.
If you could shine your light on this again, that would be great.
@jgonggrijp, I was wrong the value of github.ref
in a pull request event is refs/pull/{{ PR_NUMBER }}/merge
. Debugging with this run, I found we can fetch the branch name with github.event.pull_request.head.ref
, because of this we can use:
if: contains(github.event.pull_request.head.ref, 'release/') || contains(github.event.pull_request.head.ref, 'hotfix/')
I think it is a very common use case and it would be good to add it to the README; If it works for you; can you make a Pull request with it?
Thanks again. The job is now being run, we're getting closer! But the action is failing. There is a lot of output, it appears that some GitHub API is running into an internal server error. Can you make sense of it?
https://github.com/documentcloud/underscore-contrib/pull/238/checks?check_run_id=1573771108
This may or may not be an issue with the merge-branch action; I thought I'd try here before contacting GitHub.
I'm trying to set up a workflow where, when the "ready to launch" label is set on a pull request for a
release/*
branch, the branch in question is merged into another branch calledprepublish
. This workflow is defined here. It was inspired on the documentation.I have made three failed attempts at triggering this workflow:
master
yet)Either I'm misunderstanding how to do this, or something doesn't work as advertised in merge-branch or in the GH Actions API. Can you help me? Thanks in advance!