Bot to automatically approve Bitbucket Server PRs | Read-only mirror of https://github.com/swisscom/renovate-approve-bot-bitbucket-server — Swisscom. Issues & pull requests at the source.
  • Go 78.9%
  • Makefile 15.1%
  • Dockerfile 4.1%
  • Shell 1.9%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Denys Vitali 6313c5f9bf
Merge pull request #4 from fschlag/feature/only-approve-automerge-enabled-pr
Only approve branches that have 'automerge' enabled
2022-09-13 21:04:04 +02:00
.dockerignore feat: allow build of static binary, add version 2022-02-09 16:29:28 +01:00
.gitignore feat: allow build of static binary, add version 2022-02-09 16:29:28 +01:00
Dockerfile chore: add bash to Docker image 2022-05-25 16:37:14 +02:00
go.mod chore: bump dependencies 2022-05-25 08:50:18 +02:00
go.sum chore: bump dependencies 2022-05-25 08:50:18 +02:00
LICENSE initial commit 2022-02-09 16:12:21 +01:00
main.go Only approve branches that have 'automerge' enabled, similar to renovatebot/renovate-approve-bot-bitbucket-cloud 2022-09-07 11:43:29 +02:00
Makefile chore: improve version handling and docker build 2022-05-25 09:11:49 +02:00
README.md feat: make comments on PRs optional when approving 2022-05-19 17:07:21 +02:00
version.sh chore: improve version handling and docker build 2022-05-25 09:11:49 +02:00

renovate-approve-bot-bitbucket-server

Introduction

This is a small application, similar to renovatebot/renovate-approve-bot-bitbucket-cloud to automatically approve PRs where the current user is added as a reviewer.

The idea behind this tool is to be able to auto-approve PRs from Renovate so that, if they have automerge enabled they can be automerged by Renovate itself.

This tool doesn't automatically merge any PR, it just approves them.

Requirements

  • Docker
  • Make

Building

Docker Image

make REGISTRY= IMAGE=your-username/bb-approve-bot docker-build
make REGISTRY= IMAGE=your-username/bb-approve-bot docker-run

Warning: the default configuration assumes one of our internal Docker registries

Locally

make build
./approve-bot

Usage

Usage: approve-bot [--debug] --username USERNAME --password PASSWORD --endpoint ENDPOINT [--author-filter AUTHOR-FILTER]

Options:
  --debug, -D
  --username USERNAME, -u USERNAME [env: BITBUCKET_USERNAME]
  --password PASSWORD, -p PASSWORD [env: BITBUCKET_PASSWORD]
  --endpoint ENDPOINT, -e ENDPOINT [env: BITBUCKET_ENDPOINT]
  --author-filter AUTHOR-FILTER, -a AUTHOR-FILTER [env: BITBUCKET_AUTHOR_FILTER]
  --add-comment, -c      "true" to add a comment in addition to approving a PR, "false" to not add a comment. [default: true, env: BITBUCKET_ADD_COMMENT]
  --help, -h             display this help and exit

Quick Local Run

export BITBUCKET_USERNAME=your-username
read -s -r BITBUCKET_PASSWORD
# Type password and press enter
export BITBUCKET_PASSWORD
export BITBUCKET_ENDPOINT=https://bitbucket.example.com/rest
export BITBUCKET_AUTHOR_FILTER=renovate-bot # Only approve PRs created by this user
export BITBUCKET_ADD_COMMENT=true
make REGISTRY= IMAGE=your-username/bb-approve-bot docker-run