当另一个工作流程动作创建拉取请求时,Github操作工作流程无法在拉取请求上运行
我有2个工作流程文件.一个是test.xml,另一个是merge.xml
I have 2 workflow file. One is test.xml and other is merge.xml
test.xml运行php单元测试,如果测试成功,它将创建一个到暂存分支的请求请求(test.xml在功能分支中运行).
The test.xml run php unit test and if the test successful it will create a pull request to staging branch (the test.xml run in feature branch).
奇怪的是,如果请求请求有冲突,则不会触发merge.xml工作流.但是,当拉取请求没有任何冲突时,它将运行并合并拉取请求.我的xml是否配置错误?
The strange is, if the pull request have conflict, the merge.xml workflow will not triggered. But when the pull request don't have any conflict, it will run and merge the pull request. Did my xmls are misconfiguration?
这是xmls.
Test.xml
name: Test
on:
push:
branches-ignore:
- staging
jobs:
run-test:
runs-on: self-hosted
steps:
- name: run test
pullrequest-to-staging:
needs: [run-test]
runs-on: self-hosted
steps:
- name: Checkout current branch
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Create Pull Request to staging
uses: repo-sync/pull-request@v2
with:
github_token: ${{ secrets.BOT_TOKEN }}
pr_title: "Pulling ${{ steps.branch_name.outputs.branch }} into staging"
pr_body: ":crown: *An automated PR*"
destination_branch: "staging"
pr_label: "automerge"
merge.xml
name: merge-to-staging
on:
pull_request:
branches:
- staging
jobs:
merge-to-staging:
runs-on: self-hosted
steps:
- name: Label merge conflicts
uses: eps1lon/actions-label-merge-conflict@v2.0.0
with:
repoToken: "${{ secrets.BOT_TOKEN }}"
dirtyLabel: "conflicts"
continueOnMissingPermissions: true
- name: Merge to staging
uses: pascalgn/automerge-action@v0.12.0
env:
GITHUB_TOKEN: "${{ secrets.BOT_TOKEN }}"
不幸的是,如果pull请求存在合并冲突,则应该由 pull_request
触发的操作将不会运行.这是对GitHub操作的限制,如下所述:
Unfortunately, the action that should be triggered by pull_request
is not going to run if the pull request has merge conflicts. It's a limitation of GitHub Actions as described here: https://github.community/t/run-actions-on-pull-requests-with-merge-conflicts/17104/2