Giter VIP home page Giter VIP logo

renovate-merge-bot's Introduction

renovate-merge-bot ts

This is an action for auto-merge of Renovate pull requests.

Purpose

Problem to solve

Renovate supports the great feature of automerge, but we need to consider the following edge cases:

If any commit is added to a pull request, Renovate does not merge it.

image

If the commit status is unknown, Renovate does not merge it. For example, a workflow adds a commit using GITHUB_TOKEN which does not trigger GitHub Actions.

image

How to solve

If the following conditions are satisfied, this action adds an empty commit to trigger GitHub Actions.

  • The pull request is open
  • The pull request is created by Renovate
  • The pull request is mergeable
  • The commit status is unknown
  • The last committer is GITHUB_TOKEN

If the following conditions are satisfied, this action merges it.

  • The pull request is open
  • The pull request is created by Renovate
  • The pull request is mergeable
  • The commit status is success
  • The last commit was created at least 1 hour ago

Finally, a pull request is automatically merged even if a commit was added using GITHUB_TOKEN.

Here is the example of #5.

image

Getting Started

Create GitHub App

Create your GitHub App from this link. Here are the required permissions:

  • Contents: read and write
  • Pull Requests: read and write
  • Workflows: read and write

Install the GitHub App to your repositories.

Create repository and workflow

Create a new repository. Add the following secrets:

  • BOT_APP_ID = App ID of the GitHub App
  • BOT_APP_PRIVATE_KEY = Private key of the GitHub App

Create a workflow.

name: run

on:
  workflow_dispatch:
  schedule:
    - cron: '0 * * * *'

jobs:
  renovate-merge-bot:
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - uses: int128/renovate-merge-bot@v1
        with:
          github-app-id: ${{ secrets.BOT_APP_ID }}
          github-app-private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}

Confirm the behavior

When the workflow runs, this action finds open pull requests from repositories which the GitHub App is installed. It executes either of the following actions:

  • Add an empty commit to trigger GitHub Actions
  • Merge the pull request
  • Leave (it will be merged by user)

Specification

Inputs

Name Default Description
github-app-id (required) GitHub App ID
github-app-private-key (required) GitHub App private key
dry-run false Dry-run

Outputs

None.

renovate-merge-bot's People

Contributors

int128 avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

renovate-merge-bot's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/release.yaml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3@1e60f620b9541d16bece96c5465dc8ee9832be0b
  • int128/release-typescript-action v1.29.0@ea9cfae1900a4473a9e3efe8f6ba1822140d1229
.github/workflows/run.yaml
  • int128/renovate-merge-bot v1.43.0@50e8440544ca84028f53a89971abf82e06776d11
.github/workflows/ts.yaml
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3@1e60f620b9541d16bece96c5465dc8ee9832be0b
  • actions/checkout v4.1.7@692973e3d937129bcbf40652eb9f2f61becf3332
  • actions/setup-node v4.0.3@1e60f620b9541d16bece96c5465dc8ee9832be0b
  • int128/update-generated-files-action v2.52.0@d01a193ae8a14d7d7699981665a0922bde444389
npm
package.json
  • @actions/core 1.10.1
  • @octokit/auth-app 7.1.0
  • @octokit/core 6.1.2
  • @octokit/rest 20.1.0
  • graphql 16.9.0
  • @graphql-codegen/cli 5.0.2
  • @graphql-codegen/import-types-preset 3.0.0
  • @graphql-codegen/typescript 4.0.9
  • @graphql-codegen/typescript-operations 4.2.3
  • @octokit/graphql-schema 15.15.0
  • @tsconfig/node20 20.1.4
  • @types/jest 29.5.12
  • @types/node 20.14.13
  • @vercel/ncc 0.38.1
  • eslint 9.8.0
  • eslint-plugin-jest 28.6.0
  • jest 29.7.0
  • prettier 3.3.3
  • ts-jest 29.2.0
  • typescript 5.5.4
  • typescript-eslint 7.17.0
  • node 20.x
  • pnpm 9.6.0
regex
action.yaml
  • node 20
.github/workflows/release.yaml
  • node 20
.github/workflows/ts.yaml
  • node 20
  • node 20

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.