[英]Github Actions automerge not working as expected
I have a yml file with 5 jobs as below我有一个包含 5 个作业的 yml 文件,如下所示
The first 3 jobs work on my development branch so my file begins with前 3 个工作在我的开发分支上工作,所以我的文件以
name: Spicethedeploy
on:
push:
branches:
- development
jobs:
Job 4 I specify this工作 4 我指定这个
source_branch: "development"
destination_branch: "master"
But when job 5 runs it looks for a pull request for development not master and does not complete.但是,当作业 5 运行时,它会寻找一个非主开发的拉取请求并且没有完成。 The code for this job is:这项工作的代码是:
automerge:
needs: pull-request
runs-on: ubuntu-latest
steps:
- name: automerge
uses: pascalgn/automerge-action@v0.13.1
env:
GITHUB_TOKEN: ${{ secrets.ghp_xxxxxxxxxxxxxxxxxxxx }}
Can someone tell me how to make this job look to the master branch?有人能告诉我如何让这个工作看起来像是主分支吗?
I have created a second yml file called automerge.yml, contents below我创建了第二个名为 automerge.yml 的 yml 文件,内容如下
name: automerge
on:
pull_request:
branches:
- master
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: pascalgn/automerge-action@v0.13.1
env:
GITHUB_TOKEN: ${{ secrets.ghp_xxxxxxxxxxxxxxxxxxxxxxxx }}
MERGE_LABELS: "automerge"
The pull request has also been removed from the first yml file which now stops after creating the pull request.拉取请求也已从第一个 yml 文件中删除,该文件现在在创建拉取请求后停止。 The new yml file then kicks in and tries to merge but skips with this message新的 yml 文件然后启动并尝试合并但跳过此消息
Run pascalgn/automerge-action@v0.13.1
2021-04-04T18:36:14.889Z INFO Event name: pull_request
2021-04-04T18:36:15.102Z INFO Skipping PR update, required label missing: automerge
2021-04-04T18:36:15.102Z INFO Skipping PR merge, required label missing: automerge
Thanks to GuiFalourd for the tips which pointed me in the right direction on this.感谢 GuiFalourd 提供的提示,这些提示为我指明了正确的方向。 Following his advice led me to this solution which works well听从他的建议,我找到了这个效果很好的解决方案
merge:
needs: pull-request
name: merge
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: merge
uses: mtanzi/action-automerge@v1
id: merge
with:
github_token: ${{ secrets.ghp_xxxxxxxxxxxxxxxxxxxxxxxxx }}
source: 'development'
target: 'master'
The documentation on MERGE_LABELS: here says - MERGE_LABELS 上的文档:这里说 -
When an empty string ("") is given, all pull requests will be merged.当给出一个空字符串 ("") 时,所有的拉取请求都将被合并。
Following that, this worked for me之后,这对我有用
- id: automerge
name: automerge
uses: "pascalgn/automerge-action@v0.15.3"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
MERGE_LABELS: ""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.