Closed zeke closed 8 years ago
Also, when I console.log(pkg)
in the transform function, I can see the changes have been made to the package object.
Bump. Any ideas, @christophwitzko or @boennemann?
Hi @zeke, we have released a new major version of github-change-remote-file
yesterday.
I have adapted and tested your example:
const GitHubApi = require('github')
const githubChangeRemoteFile = require('github-change-remote-file')
const token = process.env.GITHUB_TOKEN
const github = new GitHubApi()
github.authenticate({type: 'oauth', token})
const repo = {
user: 'zeke',
repo: 'standard-markdown'
}
const newBranch = 'update-standard'
githubChangeRemoteFile(Object.assign({
github,
filename: 'package.json',
newBranch,
transform: pkg => {
pkg = JSON.parse(pkg)
pkg.dependencies.standard = '100'
return JSON.stringify(pkg, null, 2) + '\n'
}
}, repo))
.then(commit => {
return github.pullRequests.create(Object.assign({
title: 'Testing automated PRs',
body: 'This is a test. cc @zeke',
head: newBranch,
base: 'master'
}, repo))
})
.then(console.log)
.catch(console.log)
If you have any further questions feel free to ask.
Best, Christoph
Thanks!
I have the following code, derived from the README example:
When I run it, I'm getting a 422 back from GitHub.
I have verified that the
GITHUB_TOKEN
is being set, and it lots of privileges.Am I missing something, @boennemann?