Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boennemann/github-change-remote-file
♻️
https://github.com/boennemann/github-change-remote-file
Last synced: about 2 months ago
JSON representation
♻️
- Host: GitHub
- URL: https://github.com/boennemann/github-change-remote-file
- Owner: boennemann
- Created: 2015-08-01T22:14:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-17T18:18:05.000Z (almost 8 years ago)
- Last Synced: 2024-04-14T05:28:48.402Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 16
- Watchers: 5
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# github-change-remote-file
| [![Build Status](https://travis-ci.org/boennemann/github-change-remote-file.svg?branch=master)](https://travis-ci.org/boennemann/github-change-remote-file) | [![Coverage Status](https://coveralls.io/repos/boennemann/github-change-remote-file/badge.svg?branch=master&service=github)](https://coveralls.io/github/boennemann/github-change-remote-file?branch=master) | [![Dependency Status](https://david-dm.org/boennemann/github-change-remote-file/master.svg)](https://david-dm.org/boennemann/github-change-remote-file/master) | [![devDependency Status](https://david-dm.org/boennemann/github-change-remote-file/master/dev-status.svg)](https://david-dm.org/boennemann/github-change-remote-file/master#info=devDependencies) | [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) |
| --- | --- | --- | --- | --- |This module allows you to change a single file in a repository on GitHub and create a new commit or pull-request from that change. This has little to no overhead, because it doesn't work with a local copy of the git repository – everything is done via the GitHub API.
## Examples
Create a new branch and commit on top of it:
```js
githubChangeRemoteFile({
user: 'boennemann',
repo: 'animals',
filename: 'package.json',
newBranch: 'upgrade-standard',
transform: pkg => {
const parsedPkg = JSON.parse(pkg)
pkg.devDependencies.standard = semver.inc(parsedPkg.devDependencies.standard, 'major')
return JSON.stringify(parsedPkg, null, 2)
},
token: ''
})
.then(res => console.log(res))
.catch(console.log)
```Create a new commit and push it on top of the (master) branch:
```js
githubChangeRemoteFile({
user: 'boennemann',
repo: 'animals',
filename: 'package.json',
transform: pkg => {
const parsedPkg = JSON.parse(pkg)
pkg.devDependencies.standard = semver.inc(parsedPkg.devDependencies.standard, 'major')
return JSON.stringify(parsedPkg, null, 2)
},
token: ''
})
.then(res => console.log(res))
.catch(console.log)
```