Code Monkey home page Code Monkey logo

pr-bot-cli's Introduction

PR-Bot-Cli

Name: marqeta/pr-bot-cli@main

PR Bot Cli is a GitHub Action that automatically approves PRs when user-defined reuqirements are met.

Important: Allow auto-merge must be enabled for PR Bot Cli to work.

How to Use in GitHub Workflow.

GitHub Workflow is a user-configurable automated process to run CI/CD jobs.

It is very easy to use PR Bot Cli in GitHub Workflow.

1. Create Presonal Access Token

To use PR Bot Cli, you would first need to create a GitHub Personal Access Token.

Click on your profile picture at top right corner, go to settings -> developer settings -> personal access token -> fine-grained tokens, click on the generate new token.

Repo read-only and read:org permissions should be enough for PR Bot Cli to work.

Remmeber to copy your personal access token as you woould need to use in the next step.

2. Store Personal Access Token as Repository Secret

Go to your repository, click on settings.

image

Go to Secrets and variables -> actions -> New Repository Secrets. Create a new secret paste your newly created GitHub token as its value, and set its name to PR_BOT_TOKEN.

3. Enable Auto Merge for Repo

Go to settings -> general, enable allow auto-merge.

image

4. Invoke GitHub Action

Create a .github/prbot.yml under root directory of your repository.

name: PR Bot auto approval

on:
  pull_request:

jobs:
  pr-bot:
    runs-on: ubuntu-latest
    steps:
      - name: PR Bot Auto Approval
        uses: marqeta/pr-bot-cli@main
        with:
          github_token: ${{ secrets.PR_BOT_TOKEN }}

4. Create your own policy

Create a .prbot/my_policy/approval.rego and a .prbot/my_policy/filter.rego under root directorty of your repository.

In filter.rego, you could filter out the PRs that you would like PR Bot to review.

In approval.rego, you could specify the condition that PR Bot use to review / approve a PR.

You could find exmaples of PR Bot rego files at here

Example

PR bot automatically approved & merged a PR generated by dependabot for updating JavaScript version. image

pr-bot-cli's People

Contributors

yanzhou2004 avatar xueyingm avatar junxihe459 avatar

Stargazers

 avatar

Watchers

Mike Lapping avatar Prasanth Krishnan avatar

Forkers

xueyingm

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.