npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

magic-merge-plz

v0.6.2

Published

github magic merge

Downloads

47

Readme

magic-merge-plz

automate github branch merging.

This thing checks your github repos for PRs which are APPROVED and have a magic label added to them. If it finds such PRs it will merge them and delete the branch.

It is useful if you have things that run which prevent merging until they complete, and people have to constantly go back and check their status before doing the merge.

Other things it does

  • if a PR has any "changes requested" things, it will thumb down the PR
  • if a PR has no "changes requested" and at least one approval, it will thumb up the PR
  • if the magic label is added to a PR it will add itself as an assignee, and remove itself if label is removed
  • there is an option to have it mark stale PRs with "Stale PR" label.

Requirements

node 6+

Installing

npm install magic-merge-plz

Using

The export of this thing is a class named MagicMerge

the constructor takes a settings object:

{
    settings.org         string, org name - catalant
    settings.repos       array, array of repo names in org to check
    settings.label       string, magic label name, defaults to 'a magic merge plz'
    settings.user        string, username of user on whose behalf magic-merge will act
    settings.auth        object, auth object with {password} or {token}
    settings.stalePrDays number, number of days a pr should stay open to get an emitted event about it
}

the instance of MagicMerge is an EventEmitter, it emits the following events:

  • debug (args: message)
  • merged (args: pr, repo)
  • stale (args: pr, repo)
  • warning (args: message)
  • rate-limit (args: remainingRequests, minutesUntilReset)

Example

import MagicMerge from 'magic-merge-plz';

const magic = new MagicMerge({
    org: 'catalant',
    repos: ['magic-merge-plz', 'hn-webpack', 'hn-nerd-experience', 'hn-enterprise-portal', 'hn-marketing-sales'],
    label: 'a magic merge plz',
    stalePrDays: 1,
    username: 'catman',
    auth: require('./auth.json')
});

// start checking the repos for PRs with the magic merge label which are approved
magic.start().on('debug', (msg) => {
    console.log('magic-merge:', msg);
}).on('warning', (msg) => {
    console.log('magic-merge WARN:', msg);
}).on('merged', (pr, repo) => {
    console.log('MERGED!', repo, pr.number);
}).on('stale', (pr, repo) => {
    // you will see this if a pr has been open for longer than `stalePrDays`
    console.log('stale pr', pr, repo);
}).on('rate-limit', (remainingRequests, minutesUntilReset) => {
    console.log(`remaining requests: [${remainingRequests}] rate reset in minutes: [${minutesUntilReset.toFixed(2)}]`);
});