Skip to content

Instantly share code, notes, and snippets.

@DaRaFF
Last active October 19, 2018 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaRaFF/0faf9df4f2b4a7c8c392a140963e0443 to your computer and use it in GitHub Desktop.
Save DaRaFF/0faf9df4f2b4a7c8c392a140963e0443 to your computer and use it in GitHub Desktop.
Creates a Version Bump PR for Release Management of Livingdocs

Create a version bump PR

for release management of Livingdocs

Example

# GH_BUMP_TO e.g. v32.6.0
# GH_REPO_NAME e.g. livingdocs-editor
# GH_TOKEN e.g. 123f345f11234
GH_BUMP_TO=<bump-version> GH_REPO_NAME=<gh-repo-name> GH_TOKEN=<github token> npx <this url>
#!/usr/bin/env node
const octokit = require('@octokit/rest')()
const assert = require('assert')
assert(process.env.GH_TOKEN, 'missing environment variable GH_TOKEN e.g 11b22b33n4')
const token = process.env.GH_TOKEN
assert(process.env.GH_BUMP_TO, 'missing environment variable GH_BUMP_TO e.g v32.4.0')
const bumpTo = process.env.GH_BUMP_TO
assert(process.env.GH_REPO_NAME, 'missing environment variable GH_REPO_NAME e.g livingdocs-editor')
const repo = process.env.GH_REPO_NAME
octokit.authenticate({
type: 'token',
token: token
})
async function createPullRequest() {
return await octokit.pullRequests.create({
owner: 'livingdocsIO',
repo: repo,
title: `Bump minor version to ${bumpTo} for release management`,
head: `bump-${bumpTo}`,
base: 'master',
body: `## Description
Bump minor version to ${bumpTo} for release management`,
maintainer_can_modify: true
})
}
createPullRequest()
.then(response => {
console.log(`The PR for the release-management bump has been opened at ${response.data.html_url}`)
})
.catch(e => {
console.log(e)
})
{
"name": "create-bump-pr",
"version": "1.0.0",
"bin": "./create-bump-pr.js",
"dependencies": {
"@octokit/rest": "^15.9.4"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment