我在 github 存储库上激活合并队列时遇到问题。
当我的 PR 运行它的工作流程并将其添加到合并队列时,它只是坐在那里等待检查运行,但没有触发任何内容。
如果我点击合并队列界面中的详细信息按钮,它只是说我的 PR 正在等待检查运行,但检查列表为空
这是我想要激活合并队列的分支的 github 选项:
我还在我想要运行的两个工作流上添加了 merge_group 标签:
name: Build by changesets
on:
merge_group:
types:
- checks_requested
push:
branches:
- 'PAC/**'
pull_request:
types: [opened, synchronize, edited, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ (github.event.action != 'edited') || github.event.changes.base.ref.from != '' }}
jobs:
Set_up_environment:
name: Compute environment variables
runs-on: [ self-hosted ]
if: github.event_name == 'merge_group' || github.event_name == 'push' || (github.event_name == 'pull_request' && !github.event.pull_request.draft && (github.event.action != 'edited' || github.event.changes.base.ref.from != ''))
outputs:
builder: ${{ steps.set_up_builder.outputs.builder }}
workspace_base: ${{ steps.set_up_builder.outputs.workspace_base }}
reference_repo_path: ${{ steps.set_up_builder.outputs.reference_repo_path }}
branch_name: ${{ steps.get_branch_properties.outputs.branch_name }}
short_branch_name: ${{ steps.get_branch_properties.outputs.short_branch_name }}
share_name: ${{ steps.get_branch_properties.outputs.share_name }}
sonar_analysis: ${{ steps.check_sonar_tag.outputs.result }}
steps:
// many things here
name: CI/checks
on:
merge_group:
types:
- checks_requested
pull_request:
branches:
- default
- integration
- production
- deploy
- '*-Integration'
- PAC/PAC3/Integration
types: [ opened, edited, reopened, synchronize]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Checks:
timeout-minutes: 15
runs-on: [ self-hosted, github-action-runner-ubuntu ]
if: github.event_name == 'merge_group' || github.event.action != 'edited' || (github.event.action == 'edited' && github.event.changes.base.ref.from != '')
steps:
// many things here
您知道为什么我的检查没有运行吗?或者我该如何调试?
我终于找到问题了。 我们在 Github 上有一个 PreReceived 挂钩,可以检查分支名称是否是使用特定前缀创建的。它阻止 github 默默地为合并队列创建分支 (gh-readonly-queue/*)
允许前缀后,一切正常
PS:如果您使用github中的规则集功能来确保特定的分支名称,也会出现此问题,因此您也需要在此功能中添加前缀