Giter VIP home page Giter VIP logo

pristine-bot's Introduction

Pristine Bot

A Pull request bot.

  • Install Pristine-bot
  • Setup a repo that emits changes when updated.
  • Set a list of repos to listen for those changes.

Installation

npm install pristine-bot

Dependencies

  • git is required.

Configure Pristine-bot:

import PristineBot from "pristine-bot"

const config = { 
  owner: "etccorelabs",
  workingDir: __dirname,
  templateConfigs: [
    {
      template: "pristine",
      listeningRepos: [
        "testing_repo_1", 
        "testing_repo_2"
      ]
    }, 
    {
      template: "pristine-typescript",
      listeningRepos: [ 
        "testing_repo_3" 
      ]
    }
  ]
}

async function startBot() {
  const bots = await PristineBot(config)

  bots.map((bot) => {    
    bot.on("error", async (error) => {
      console.log("-- REPO_PR_ERROR --", error)
    })
  
    bot.on("submitted", async (repo) => {
      console.log("-- REPO_PR_SUBMITTED --", repo)
    })
  
    bot.on("completed", async (repos) => {
      console.log("-- ALL_REPO_PRS_SUBMITTED --", repos)
    })
  })
}

startBot()

Configuration options:

Option Description
owner The name of the account owner or org. (required)
workingDir A root dir to clone repos to. example: "/ROOT/tmp/repos". (required)
templateConfigs[] An array of template configs. (required)

Template Config

Option Description
template The name of the template repo (required)
listeningRepos Repos subscribed to template changes (required)
defaultRemote Remote name to set for remote template url. (optional)
defaultBranchName Name of the branch where changes will be implemented: feat/pristine-changes. (optional)
defaultPRTitle The title of the Pull Request, default: Pristine changes. (optional)
defaultConflictCommitMessage The commit message for merge conflicts, default: fix: Pristine changes with conflicts. (optional)
defaultPRBody The contents of the Pull Request, default: N/A. (optional)

Pristine-bot is powered by Probot:

To run your app in development, you will need to configure a GitHub App to deliver webhooks to your local machine.

  1. On your local machine, copy .env.example to .env.

Example:

APP_ID=0111
PRIVATE_KEY="PRIVATE"
WEBHOOK_SECRET="SECRET"
WEBHOOK_PROXY_URL=https://smee.io/SMEE_ID
  1. Go to smee.io and click Start a new channel. Set WEBHOOK_PROXY_URL in .env to the URL that you are redirected to.

  2. Create a new GitHub App with:

  • Webhook URL: Use your WEBHOOK_PROXY_URL from the previous step.

  • Webhook Secret: development (Note: For optimal security, Probot apps require this secret be set, even though it's optional on GitHub.).

  • Permissions & events is located lower down the page and will depend on what data you want your app to have access to. Note: if, for example, you only enable issue events, you will not be able to listen on pull request webhooks with your app. However, for development we recommend enabling everything.

  1. Download the private key and move it to your project's directory. As long as it's in the root of your project, Probot will find it automatically regardless of the filename.

  2. Edit .env and set APP_ID to the ID of the app you just created. The App ID can be found in your app settings page here

Probot docs.

Give PristineBot access to all repos listed in config:

  • Go to org or repo settings and click installed github apps.

Deployment:

  • Pristine-bot for production: link

Contributing

How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.

pristine-bot's People

Contributors

belfordz avatar devonwesley avatar meowsbits avatar shanejonas avatar stevanlohja avatar

Watchers

 avatar  avatar  avatar  avatar

pristine-bot's Issues

Pull Request bot

@shanejonas original comments:

  • if you've forked from or are a pristined project we can track it and make a pull request back when pristine base repository changes.

  • we can poll for either certain commits, or all commits from etclabscore/pristine in an orgs repos, and then if pristine changes, make a PR back with the changes.

  • heres a good start for a github app bot: https://probot.github.io/docs/

  • ideally we can re-use some of this to get some generator-client auto PR's as well

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.