boennemann / github-change-remote-file Goto Github PK
View Code? Open in Web Editor NEW♻️
♻️
I've tried to fix that in here: https://github.com/marcbachmann/github-change-remote-file/commit/921a97f8ad2eab826803ab7895f8622fdd8f6236
But then I saw that github probably needs an update of a whole tree and currently reading of a file and updating a tree are completely separated.
Hi. The README used to have a section about creating pull requests: https://github.com/boennemann/github-change-remote-file/blob/8f55a5a13f974ad0a2b69939d55350f2fb36db16/README.md
The sample code looked like this. Note the pr
stanza:
githubChangeRemoteFile({
user: 'boennemann',
repo: 'animals',
filename: 'package.json'
transform: function (pkg) {
pkg = JSON.parse(pkg)
pkg.devDependencies.standard = semver.inc(pkg.devDependencies.standard, 'major')
return JSON.stringify(pkg)
},
token: '<github access token with sufficent rights>',
pr: {
title: 'Updated standard to latest version',
body: 'whatever'
}
}, function (err, res) {
console.log(res.html_url) // url of the pr
})
It looks like that documentation (and functionality?) were removed. Is it still possible? If not, are you using a different package now to create PRs?
Thanks!
I have the following code, derived from the README example:
require('dotenv').load()
const githubChangeRemoteFile = require('github-change-remote-file')
githubChangeRemoteFile({
user: 'zeke',
repo: 'standard-markdown',
filename: 'package.json',
transform: function (pkg) {
pkg = JSON.parse(pkg)
pkg.dependencies.standard = '100'
return JSON.stringify(pkg, null, 2)
},
token: process.env.GITHUB_TOKEN,
pr: {
title: 'Testing automated PRs',
body: 'This is a test. cc @zeke'
}
}, function (err, res) {
console.log(JSON.stringify(err, null, 2))
console.log(JSON.stringify(res, null, 2))
})
When I run it, I'm getting a 422 back from GitHub.
❯ node index.js
{
"code": 422,
"message": "{\"message\":\"Validation Failed\",\"errors\":[{\"resource\":\"PullRequest\",\"field\":\"head\",\"code\":\"invalid\"}],\"documentation_url\":\"https://developer.github.com/v3/pulls/#create-a-pull-request\"}"
}
undefined
I have verified that the GITHUB_TOKEN
is being set, and it lots of privileges.
Am I missing something, @boennemann?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.