• Stars
    star
    341
  • Rank 123,998 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automatically merge Dependabot PRs when version comparison is within range

GitHub Action: Dependabot Auto Merge

Automatically merge Dependabot PRs when version comparison is within range.

license release

Note: Dependabot will wait until all your status checks pass before merging. This is a function of Dependabot itself, and not this Action.

Usage

name: auto-merge

on:
  pull_request:

jobs:
  auto-merge:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: ahmadnassri/action-dependabot-auto-merge@v2
        with:
          target: minor
          github-token: ${{ secrets.mytoken }}

The action will only merge PRs whose checks (CI/CD) pass.

Examples

Minimal setup:

steps:
  - uses: ahmadnassri/action-dependabot-auto-merge@v2
    with:
      github-token: ${{ secrets.mytoken }}

Only merge if the changed dependency version is a patch (default behavior):

steps:
  - uses: ahmadnassri/action-dependabot-auto-merge@v2
    with:
      target: patch
      github-token: ${{ secrets.mytoken }}

Only merge if the changed dependency version is a minor:

steps:
  - uses: ahmadnassri/action-dependabot-auto-merge@v2
    with:
      target: minor
      github-token: ${{ secrets.mytoken }}

Using a configuration file:

.github/workflows/auto-merge.yml
steps:
  - uses: actions/checkout@v2
  - uses: ahmadnassri/action-dependabot-auto-merge@v2
    with:
      github-token: ${{ secrets.mytoken }}
.github/auto-merge.yml
- match:
    dependency_type: all
    update_type: "semver:minor" # includes patch updates!

Inputs

input required default description
github-token βœ” github.token The GitHub token used to merge the pull-request
config βœ” .github/auto-merge.yml Path to configuration file (relative to root)
target ❌ patch The version comparison target (major, minor, patch)
command ❌ merge The command to pass to Dependabot
botName ❌ dependabot The bot to tag in approve/comment message.
approve ❌ true Auto-approve pull-requests

Token Scope

The GitHub token is a Personal Access Token with the following scopes:

  • repo for private repositories
  • public_repo for public repositories

The token MUST be created from a user with push permission to the repository.

β„Ή see reference for user owned repos and for org owned repos

Configuration file syntax

Using the configuration file (specified with config input), you have the option to provide a more fine-grained configuration. The following example configuration file merges

  • minor updates for aws-sdk
  • minor development dependency updates
  • patch production dependency updates
  • minor security-critical production dependency updates
- match:
    dependency_name: aws-sdk
    update_type: semver:minor

- match:
    dependency_type: development
    update_type: semver:minor # includes patch updates!

- match:
    dependency_type: production
    update_type: security:minor # includes patch updates!

- match:
    dependency_type: production
    update_type: semver:patch

Match Properties

property required supported values
dependency_name ❌ full name of dependency, or a regex string
dependency_type ❌ all, production, development
update_type βœ” all, security:*, semver:*

update_type can specify security match or semver match with the syntax: ${type}:${match}, e.g.

  • security:patch
    SemVer patch update that fixes a known security vulnerability

  • semver:patch
    SemVer patch update, e.g. > 1.x && 1.0.1 to 1.0.3

  • semver:minor
    SemVer minor update, e.g. > 1.x && 2.1.4 to 2.3.1

To allow prereleases, the corresponding prepatch, preminor and premajor types are also supported

Defaults

By default, if no configuration file is present in the repo, the action will assume the following:

- match:
    dependency_type: all
    update_type: semver:${TARGET}

Where $TARGET is the target value from the action Inputs

The syntax is based on the legacy dependaBot v1 config format. However, in_range is not supported yet.

Exceptions and Edge Cases

  1. Parsing of version ranges is not currently supported
Update stone requirement from ==1.* to ==3.*
requirements: update sphinx-autodoc-typehints requirement from <=1.11.0 to <1.12.0
Update rake requirement from ~> 10.4 to ~> 13.0
  1. Parsing of non semver numbering is not currently supported
Bump actions/cache from v2.0 to v2.1.2
chore(deps): bump docker/build-push-action from v1 to v2
  1. Sometimes Dependabot does not include the "from" version, so version comparison logic is impossible:
Update actions/setup-python requirement to v2.1.4
Update actions/cache requirement to v2.1.2

if your config is anything other than update_type: all, or update_type: semver:all the action will fallback to manual merge, since there is no way to compare version ranges for merging.


Author: Ahmad NassriΒ β€’ Twitter: @AhmadNassri

More Repositories

1

app-restconsole

HTTP Client and Request Visualizer and Constructor tool, helps developers build, debug and test RESTful APIs
JavaScript
243
star
2

awesome-startup-resources

A curated list of useful resources for building a new startup business
141
star
3

restful-zend-framework

Extension for the popular Zend Framework, allows to create RESTful Controllers and build API endpoints with ease.
PHP
138
star
4

docker-vscode-server

a Docker image for VS Code Server
Makefile
89
star
5

node-har-validator

Extremely fast HTTP Archive (HAR) validator using JSON Schema
JavaScript
61
star
6

css-diagonal-separators

Pure CSS Diagonal Separators
HTML
58
star
7

action-workflow-queue

if the same workflow is already running from a previous commit, wait for it to finish
JavaScript
57
star
8

node-har

HTTP Archive (HAR) Dynamic Object
JavaScript
54
star
9

node-glob-promise

Promise version of glob
JavaScript
53
star
10

awesome-coworking

Directory of Awesome Co-Working spaces around the globe
52
star
11

action-workflow-run-wait

wait for all `workflow_run` required workflows to be successful
JavaScript
37
star
12

action-terraform-report

Updates Pull Requests with visual diff of Terraform Plan changes
JavaScript
35
star
13

har-spec

The HTTP Archive Spec
31
star
14

mkdirp-promise

Promise version of mkdirp
JavaScript
30
star
15

docs-engineering-matrix

Engineering Team Competency & Skill Matrix
29
star
16

restful-zend-framework-example

Example RESTful Application using Zend Framework 1.0
PHP
28
star
17

har-resources

A community curated list of resources, tools, projects and applications that support HTTP Archive (HAR).
HTML
28
star
18

node-pretty-exceptions

Pretty and more helpful uncaught exceptions, automatically
JavaScript
26
star
19

rest-codes

JavaScript
23
star
20

node-api-problem

HTTP Problem Utility
JavaScript
22
star
21

node-metalsmith-pug

Metalsmith plugin to convert jade files
JavaScript
21
star
22

awesome-accelerators

A curated list of startup accelerators around the globe
20
star
23

har-schema

schema package for HTTPArchive (HAR)
JavaScript
19
star
24

node-metalsmith-paths

Metalsmith plugin that adds file path values to metadata
JavaScript
19
star
25

node-metalsmith-imagemin

Metalsmith plugin to minify images
JavaScript
18
star
26

node-nightwatch-accessibility

Nightwatch.js utility assertion for accessibility testing with aXe
JavaScript
18
star
27

benchmark-node-clone

Node Clone Benchmarks
JavaScript
17
star
28

echint

Quick validation of files against EditorConfig
JavaScript
16
star
29

node-april-fools

A time bomb that will throw a randomly generated `Error` on April 1st
Makefile
15
star
30

node-metalsmith-request

Metalsmith plugin to grab content from the web and expose the results to metadata
JavaScript
15
star
31

action-semantic-release

Semantic Release with all the presets
JavaScript
13
star
32

google-maps-polygon-rotate

Programmatically rotate a google.maps.Polygon around an angle or its center using Google Maps V3
JavaScript
13
star
33

node-oas-request

OAS 3.x dynamic request client
JavaScript
12
star
34

benchmark-node-json-parse

What is the fastest method to parse JSON files?
JavaScript
10
star
35

action-template-repository-sync

Keep projects in sync with the template repository they came from
JavaScript
10
star
36

node-autoenv

Automatically loads environment variables from named .env files
Makefile
9
star
37

awesome-incubators

A curated list of startup incubators around the globe
9
star
38

docker-node-puppeteer

node & puppeteer in one container
Dockerfile
9
star
39

action-google-cloud-sql-proxy

Shell
8
star
40

template-js-lib

a template repo for a node project
JavaScript
8
star
41

pkg-config

parse the closest package.json and get package specific configurations
JavaScript
8
star
42

gaza-everywhere

A Google Maps app to help visualize Gaza's size in relative to locations around the world
JavaScript
8
star
43

node-oas-fastify

OAS 3.0 to Fastify routes automation
JavaScript
8
star
44

docker-github-pages

jekyll & github-pages in one container
Makefile
7
star
45

node-spawn-promise

Child Process Spawn as a Promise, with simple in/out piping
JavaScript
7
star
46

forwarded-http

Resolve RFC 7239 (Forwarded HTTP Extension), with fallback to all legacy & special Forward headers
JavaScript
7
star
47

action-commit-lint

commitlint your PRs with a default configuration auto applied
JavaScript
7
star
48

template-node-lib

a template repo for a node project
Makefile
6
star
49

har-cli

HAR tools in the command line
JavaScript
6
star
50

node-serve-reload-replace

simple http server with built-in live reload, server-sent events, server side includes, and more!
JavaScript
6
star
51

node-template-literals-engine

a very simple template engine for template literals
JavaScript
6
star
52

oh-my-log

Beautiful console logs for your console application
JavaScript
6
star
53

node-updated

check for updated package.json dependencies
JavaScript
5
star
54

template-template

A template for GitHub Template Repositories!
Makefile
5
star
55

parakeet

Echo server for TCP/UDP/HTTP
JavaScript
5
star
56

template-docker

a template for Docker projects
Makefile
4
star
57

node-fs-writefile-promise

Promise version of fs.writefile
JavaScript
4
star
58

action-github-registry-npm-proxy

sets up an .npmrc file that points to GPR as a proxy
Makefile
4
star
59

furmat

super powered printf & util.format equivalent string formatting, with locals & chainable modifiers
JavaScript
4
star
60

chrome-link-preview

Right click on a link to quickly preview its content in a nice summary card, without leaving the page
JavaScript
4
star
61

node-marked-promise

Promise version of marked
Makefile
3
star
62

logress

log your progress, with logress!
JavaScript
3
star
63

node-smart-promise

a Promise extension that provides filtered catch handler
JavaScript
3
star
64

node-error

Extendable Error Class for use with Node >= 4.x
JavaScript
3
star
65

action-changed-files

detect changed files in a Commit or PR
Shell
3
star
66

actions

Makefile
3
star
67

node-winston-tcp

TCP transport for Winston
JavaScript
3
star
68

node-stringify-clone

Wrapper for fast object cloning using `JSON.parse` & `JSON.stringify`
Makefile
3
star
69

i-jest-you-not

Who needs Jest anyways?
JavaScript
2
star
70

node-debug

Debugging utility using environment regex, matches node core's debugging technique
JavaScript
2
star
71

node-uncaught-extender

Extends uncaughtException and unhandledRejection with custom listeners
JavaScript
2
star
72

docker-mermaid-cli

docker image for mermaid-cli with puppeteer
Makefile
2
star
73

action-metadata

get all the repo and event metadata for use in Actions
Shell
2
star
74

template-action-composite

a template repo for a composite github actions
Makefile
2
star
75

docker-gollum

docker image for gollum wiki
Makefile
2
star
76

action-npm-global-path

configure GitHub Actions to work with npm --global
Makefile
1
star
77

node-install-group

Dependency grouping for npm-install
JavaScript
1
star
78

docker-rapidoc-server

RapiDoc server with live reload
HTML
1
star
79

simple-file-cache

a simple and easy to use file-based cache
JavaScript
1
star
80

template-action-docker

a template repo for docker-based github actions
Makefile
1
star
81

template-action-node

a template repo for node.js github actions
Makefile
1
star
82

node-oas-schemas

OAS Schemas
JavaScript
1
star
83

template-terraform

A template for Terraform Template Repositories!
Makefile
1
star
84

docker-unifi-api-browser

A docker image for UniFi-API-Browser
PHP
1
star
85

node-cloudevents-schemas

CloudEvents Schema
Makefile
1
star
86

action-dotenv

assign .env files values into $GITHUB_ENV
Makefile
1
star
87

action-slack-workflow-notifications

Fully detailed GitHub Actions workflow notifications in Slack
JavaScript
1
star
88

logo-builder

a simple logo spec builder
JavaScript
1
star
89

node-test

improved native test runner for node.js
Makefile
1
star