Skip to content

sfm-tools/bighut-relabel

Repository files navigation

bighut-relabel

NPM Version License Build Status Coverage Status Last Commit Node Version

Node.js library for automatically analyzing and managing pull requests on GitHub.

Features

  • Fluent API.
  • Getting information about a pull request, including state, title, description, author info, labels, milestone, merge direction, conflicts, files, commits, comments, and reviewers.
  • Updating title, description, labels, and milestone.
  • Adding new comments to pull requests.
  • Creation and removing code review requests.
  • Deleting branches.
  • Simple conditions for pull requests analysis.
  • Flex customization.

Install

npm install bighut-relabel

Usage

import { createConfig, fix, test } from 'bighut-relabel';

// create config
const config = createConfig();

// automatic addition of labels depending on file extensions
// please note, labels should already be present in the repository

config
  .addLabel('back end')
  .whenFilePath(/\.cs$/);

config
  .addLabel('front end')
  .whenFilePath(/\.(((t|j)sx?)|(s?css))$/);

// repository options
const repository = {
  config: config,
  auth: {
    owner: '%GITHUB USERNAME OR ORG NAME HERE%',
    repo:  '%GITHUB REPOSITORY NAME HERE%',
    // https://github.com/sfm-tools/bighut-relabel
    //                   ^^^^^^^^  ^^^^^^^^^^^^^^
    //                   owner     repo
    token: '%YOUR GITHUB TOKEN HERE%',
  },
  // optional settings
  /*
  options: {
    threads: 10,
    limit: 50,
    rateLimitNotify: 2500,
    cache: {
      ttl: 600, // caching for 600 seconds
    },
    log: 'actions', // levels: info (default), action, warining, error, debug, custom
  }
  */
};

// preview - without making any changes to pull requests
test(repository);

// or apply changes to pull requests
// fix(repository);

License

MIT