Giter VIP home page Giter VIP logo

tjenkinson / gh-action-auto-merge-dependency-updates Goto Github PK

View Code? Open in Web Editor NEW
14.0 5.0 6.0 2.93 MB

A GitHub action that will automatically approve and merge a PR that only contains dependency updates, based on some rules. Also possible to disable the merge and use the `success` output to use in combination with other actions.

License: MIT License

TypeScript 99.57% Shell 0.43%
action gh-action updater dependency dependabot security automation merge automerge

gh-action-auto-merge-dependency-updates's Introduction

gh-action-auto-merge-dependency-updates

A GitHub action that will automatically approve and merge a PR that only contains dependency updates, based on some rules.

If you run tests on PR's make sure you configure those as required status checks so that they need to go green before the merge can occur.

Note that the action does not check the lockfile is valid, so you should only set allowed-actors you trust, or validate that the lockfile is correct in another required action.

It currently supports npm and yarn.

By default this action will poll the API and wait for all status checks to pass which is not very efficient. It's recommended that you:

  • Enable auto merge on your repo
  • Enable the use-auto-merge option in the action
  • Configure this action as a required status check
    • This is so that if a PR is updated and auto merge needs disabling, the PR cannot auto merge before that happens

Config

  • use-auto-merge: [Recommended] Enable GitHub auto merge on the PR and exit instead of waiting for the checks to complete and merging. Auto merge must be enabled on the repo, and you should make sure this is a required status check. Default: false
  • allowed-actors: A comma separated list of usernames auto merge is allowed for.
  • repo-token (optional): a GitHub API token. Default: The token provided to the workflow (${{ github.token }})
  • allowed-update-types (optional): A comma separated list of types of updates that are allowed. Supported: [devDependencies|dependencies]:[major|minor|patch|premajor|preminor|prerelease]. Default: devDependencies:minor, devDependencies:patch
  • approve (optional): Automatically approve the PR if it qualifies for auto merge. Default: true
  • package-block-list (optional): A comma separated list of packages that auto merge should not be allowed for.
  • package-allow-list (optional): A comma separated list of packages that auto merge should only be allowed for. Omit to allow all packages.
  • merge (optional): Merge the PR if it qualifies. Default: true
  • merge-method (optional): Merge method. Supported: merge, squash, rebase Default: merge

You should configure this action to run on the pull_request_target event. If you use pull_request you might need to provide a custom repo-token which has permission to merge. The default token for dependabot PRs only has read-only access.

Outputs

A success output is set to true if a commit is eligible for auto merge.

Example Action

name: Auto Merge Dependency Updates

on:
  - pull_request_target

jobs:
  auto-merge-dependency-updates:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    concurrency:
      group: 'auto-merge-dependency-updates:${{ github.head_ref }}'
      cancel-in-progress: true
    steps:
      - uses: tjenkinson/gh-action-auto-merge-dependency-updates@v1
        with:
          use-auto-merge: true
          allowed-actors: dependabot[bot]

gh-action-auto-merge-dependency-updates's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar github-actions[bot] avatar snowmarble avatar tjenkinson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gh-action-auto-merge-dependency-updates's Issues

API Rate limit

First of all, thank you for your action. It nicely does what it says on the tin.

How much is the rate limit for one day? I've hit the limit and my automerge stopped but I did not expect it, so, could you please add this to your documentation?

Thanks

Add package-allow-list (secure by default)

There should be an option to only merge packages (with possible wildcards) on an allow list. This would let people configure packages trusted for auto merge and not expose everything.

A block list is too tedious for this and is easy for things to slip by. It's much safer to explicitly enable packages or package wildcards.

Generic dependency support (not only NPM)

Is there a way to extract the dependency name and versions from the Dependabot PR? That would enable this action to work for all dependency types instead of just ones with a package.json:

For example:
Humanizr/Humanizer#1099

That shows the dependency name, original and destination version. That seems like it has all the information required for this action to decide if it should be auto merged or not?

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.