首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >当拉请求由另一个工作流操作创建并且有冲突时,Github操作工作流不会在拉请求上运行

当拉请求由另一个工作流操作创建并且有冲突时,Github操作工作流不会在拉请求上运行
EN

Stack Overflow用户
提问于 2020-11-28 09:03:59
回答 2查看 9.7K关注 0票数 5

我有两个工作流文件。一个是test.xml,另一个是merge.xml

test.xml运行php单元测试,如果测试成功,它将创建一个对暂存分支的拉请求( test.xml运行在特性分支中)。

奇怪的是,如果拉请求有冲突,merge.xml工作流将不会触发。但是,当拉请求没有任何冲突时,它将运行并合并拉请求。我的xml是不是配置错误了?

这是xml。

Test.xml

代码语言:javascript
复制
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

代码语言:javascript
复制
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 }}"
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-12-10 14:22:22

不幸的是,如果拉请求有合并冲突,pull_request应该触发的操作不会运行。这是GitHub操作的一个限制,如下所述:https://github.community/t/run-actions-on-pull-requests-with-merge-conflicts/17104/2

票数 11
EN

Stack Overflow用户

发布于 2022-08-08 11:42:01

来自GitHub文档,这是预料中的

注意:如果拉请求有合并冲突,工作流将不会在pull_request活动上运行。必须首先解决合并冲突。

它们还记录了可以使用的pull_request_target

与解决方案一起:相反,即使拉请求有合并冲突,带有pull_request_target事件的工作流也会运行。在使用pull_request_target触发器之前,您应该意识到安全风险。有关更多信息,请参见pull_request_target。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65047992

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档