【发布时间】:2020-02-19 23:35:24
【问题描述】:
我们的 circleci 提交工作流程中有两个工作。第一个 (build_and_test) 构建我们的 iOS 项目并运行我们的一些单元测试。第二个 (build_and_snapshot) 构建我们的 iOS 项目并运行一些运行时间更长的 UI 测试。我们希望 build_and_test 在每次提交时运行,包括在分支上进行的提交,而运行时间较长的 build_and_snapshot 仅在 master 上运行。
但是,我们也希望能够在分支上运行build_and_snapshot 命令。因此,我们添加了一个 GitHub Action,以便如果您添加以下 PR 评论:/snapshot <branch_name> circleci 在分支 <branch_name> 上运行 build_and_snapshot。
这是我们的工作流程 YAML 文件:
name: Comment commands handler
on:
issue_comment:
types: [created]
jobs:
snapshot:
runs-on: macos-latest
if: contains(github.event.comment.body, '/snapshot') && github.event.issue.pull_request
steps:
- name: Run snapshots job
shell: bash
run: BRANCH_NAME=${COMMENT_BODY#* } && curl -u our_circle_ci_api_key -d build_parameters[CIRCLE_JOB]=build_and_snapshot "https://circleci.com/api/v1.1/project/gh/project/repo/tree/${BRANCH_NAME}"
env:
COMMENT_BODY: ${{ github.event.comment.body }}
这可行,但如果它正在运行,它会取消build_and_test。我认为这是因为 circleci 设置取消了冗余构建。除了禁用该设置之外,有什么办法可以解决这个问题吗?我们是否需要轮询并等到build_and_test 完成?
【问题讨论】:
标签: github-actions circleci-2.0