更新时间:2022-06-25 05:08:09
If you look at the documentation of the create-pull-request action, it mentions that
创建请求请求"操作将:
Create Pull Request action will:
它总是需要一个中间分支来提交更改.
It would always need an intermediary branch where it can commit the changes.
因此,如果您按以下方式修改工作流配置,请添加Reset master branch
步骤以从远程develop
分支获取最新更改并重置master
分支,并为操作(工作流)指定branch: temp
会创建一个temp
分支,其提交与您推送到develop
分支的提交相同,并打开从temp
到master
分支的PR.在随后的开发承诺中,它将继续对temp
分支进行相同的更改,并类似地打开PR或更新现有PR.
So if you modify your workflow config as below, adding the Reset master branch
step to get the latest changes from the remote develop
branch and reset the master
branch, and specify branch: temp
for the action, the workflow would create a temp
branch with the same commits that you have pushed to develop
branch and open a PR from temp
to master
branch. In subsequent commits to develop, it would keep on making the same changes to temp
branch and open a PR similarly or update the existing PR.
name: Create pull request
on:
push:
branches:
- develop
jobs:
prForMasterBranch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
- name: Reset master branch
run: |
git fetch origin develop:develop
git reset --hard develop
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
commit-message: update master branch
title: Update master branch
branch: temp
请注意,temp
分支将具有推送到develop
分支的确切提交.
Note that the temp
branch will have the exact commits that are pushed to the develop
branch.