如何自动合并Dependabot更新(配置版本2)? [英] How do I automerge dependabot updates (config version 2)?

查看:72
本文介绍了如何自动合并Dependabot更新(配置版本2)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在"Dependabot正在本地迁移到GitHub!"之后,我不得不更新我的Dependabot配置文件以使用版本2格式.

我的 .dependabot/config.yaml 确实像这样:

 版本:1update_configs:-package_manager:"python"目录:"/"update_schedule:实时";automerged_updates:- 比赛:dependency_type:全部";update_type:全部"; 

我有以下工作:

 版本:2更新:-包裹生态系统:点子目录:"/"日程:间隔:每天 

但是我似乎无法再次添加自动合并选项(使用 dependabot验证程序进行检查时)?

解决方案

这是不需要任何其他市场安装的解决方案(最初是 名称:"Dependabot Automerge-Action";上:pull_request:职位:工人:运行:ubuntu-latest如果:github.actor =='dependabot [bot]'脚步:-名称:自动合并用途:actions/github-script@0.2.0和:脚本:github.pullRequests.createReview({所有者:context.payload.repository.owner.login,回购:context.payload.repository.name,pull_number:context.payload.pull_request.number,事件:"APPROVE"})github.pullRequests.merge({所有者:context.payload.repository.owner.login,回购:context.payload.repository.name,pull_number:context.payload.pull_request.number})github-令牌:$ {{github.token}}

GitHub Marketplace 上也有各种第三方解决方案.>

Following "Dependabot is moving natively into GitHub!", I had to update my dependabot config files to use version 2 format.

My .dependabot/config.yaml did look like:

version: 1
update_configs:
  - package_manager: "python"
    directory: "/"
    update_schedule: "live"
    automerged_updates:
      - match:
          dependency_type: "all"
          update_type: "all"

I've got the following working:

version: 2
updates:
- package-ecosystem: pip
  directory: "/"
  schedule:
    interval: daily

but I can't seem to add the automerge option again (when checking with the dependabot validator)?

解决方案

Here is one solution that doesn't require any additional marketplace installations (originally found here). Simply create a new GitHub workflow (e.g. .github/workflows/dependabotautomerge.yml) containing:

name: "Dependabot Automerge - Action"

on:
  pull_request:

jobs:
  worker:
    runs-on: ubuntu-latest

    if: github.actor == 'dependabot[bot]'
    steps:
      - name: automerge
        uses: actions/github-script@0.2.0
        with:
          script: |
            github.pullRequests.createReview({
              owner: context.payload.repository.owner.login,
              repo: context.payload.repository.name,
              pull_number: context.payload.pull_request.number,
              event: 'APPROVE'
            })
            github.pullRequests.merge({
              owner: context.payload.repository.owner.login,
              repo: context.payload.repository.name,
              pull_number: context.payload.pull_request.number
            })
          github-token: ${{github.token}}

There are also various third-party solutions available on GitHub Marketplace.

这篇关于如何自动合并Dependabot更新(配置版本2)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆