【问题标题】:Github actions workflow doesn’t run on pull request when pull request is created by another workflow action and have conflict当拉取请求由另一个工作流操作创建并存在冲突时,Github 操作工作流不会在拉取请求上运行
【发布时间】:2021-03-10 20:46:07
【问题描述】:

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

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

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

这里是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 }}"

【问题讨论】:

    标签: github-actions


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2022-11-03
      • 2021-07-24
      • 1970-01-01
      • 2020-10-22
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      • 2020-06-25
      • 2021-07-22
      相关资源
      最近更新 更多