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

github-pr-release

v1.3.6

Published

Create a release pull request by Github API

Downloads

16,354

Readme

github-pr-release

Create a release pull request using GitHub API. Inspired by git-pr-release.

  • No dependency on git. You can easily deploy it to Heroku / AWS Lambda / Google Cloud Functions etc.
  • Fast because it uses only Github API.
  • Written in JavaScript.

Gyazo

Usage

<<<<<<< HEAD

release(config)

=======

API: release(config)

origin/master

Create a release pull request and return Promise.

You must pass a config as an argument.

const release = require("github-pr-release");

const config = {
  token: "your github token",
  owner: "uiur",
  repo: "awesome-web-app",
  head: "master", // optional
  base: "production", // optional
  template: "/path/to/template.mustache", // optional
};

release(config).then(function (pullRequest) {
  // success
  // `pullRequest` is an object that github api returns.
  // See: https://developer.github.com/v3/pulls/#get-a-single-pull-request
});

Also, the following environment variables can be used for the config:

  • GITHUB_PR_RELEASE_OWNER
  • GITHUB_PR_RELEASE_REPO
  • GITHUB_PR_RELEASE_TOKEN
  • GITHUB_PR_RELEASE_HEAD
  • GITHUB_PR_RELEASE_BASE
  • GITHUB_PR_RELEASE_ENDPOINT

CLI

You can create a release pull request by the following command:

❯ npx github-pr-release owner/repo --head master --base production
# `GITHUB_PR_RELEASE_TOKEN` is required

--help:

❯ npx github-pr-release --help
Usage: github-pr-release [repo]

Options:
  --help     Show help                                                 [boolean]
  --version  Show version number                                       [boolean]
  --head                                                     [default: "master"]
  --base                                                 [default: "production"]

Examples:
  github-pr-release uiur/github-pr-release --head master --base production

Install

npm install github-pr-release

Tips

Pull request titles

If one of pull requests of which consist a release pull request has a title like "Bump to v1.0", the title of the release pull request becomes "Release v1.0". Otherwise, it uses timestamps like "Release 2000-01-01 00:00:00" in local timezone.

Specify a message format

You can specify a template to change the message format. Pass a template path to config.template.

release({
  token: 'token'
  owner: 'uiur',
  repo:  'awesome-web-app',
  template: './template.mustache'
})

The default template is below. The first line is treated as the title.

Release {{version}}
{{#prs}}
- [ ] #{{number}} {{title}} {{#assignee}}@{{login}}{{/assignee}}{{^assignee}}{{#user}}@{{login}}{{/user}}{{/assignee}}
{{/prs}}

GitHub Enterprise

If you use this plugin in GitHub Enterprise, you can specify endpoint domain for GitHub Enterprise.

release({
  token: 'token'
  owner: 'uiur',
  repo:  'awesome-web-app',
  endpoint: 'https://github.yourdomain.com/api/v3'
})

Example

GitHub Actions

Creating release pull requests can be automated using GitHub Actions.

Create .github/workflows/create-pr-release.yml with the following content:

name: Create release pull requests

on:
  push:
    branches: [master]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: "yarn"

      - run: yarn install
      - name: Create release pull requests
        run: |
          npx github-pr-release $GITHUB_REPOSITORY --head master --base production
        env:
          GITHUB_PR_RELEASE_TOKEN: ${{ secrets.GITHUB_TOKEN }}

hubot

release = require('github-pr-release')
module.exports = (robot) ->
  robot.respond /release/i, (msg) ->
    release(config).then((pullRequest) ->
      msg.send pullRequest.html_url
    )
    .catch((err) ->
      msg.send("Create release PR failed: " + err.message)
    )

Development

The release flow of github-pr-release is managed with github-pr-release itself.

It creates a release pull request when merging a topic branch or pushing to the main branch. The update can be published by merging a release pull request.

License

MIT