我想为代码审查创建PR,以便每当有人向dev分支推送时,将 master 分支(基础)与 dev 分支进行比较为该PR指定审阅者。
我知道这可以通过Github Actions和工作流程来实现,我也为此编写了一个yaml文件,如下所示:
name: Create Pull Request
on:
push:
branches: [ dev ]
jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v2.8.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Just a test of PR
title: 'Test PR for github action'
labels: automated pr
assignees: assignee1
reviewers: reviewer1, reviewer2
draft: false
base: master
branch: dev
当我运行此工作流时,会收到以下日志:
Pull request branch to create or update set to 'create-pull-request/patch'
Configured git committer as 'GitHub <noreply@github.com>'
Configured git author as 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
Rebasing commits made to branch 'dev' on to base branch 'master'
Pull request branch 'create-pull-request/patch' does not exist yet
Branch 'create-pull-request/patch' is not ahead of base 'master' and will not be created
没有创建PR,但是Github Actions工作流程成功运行。 解决方案受到高度赞赏。