Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@boennemann/github-change-remote-files

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boennemann/github-change-remote-files

create a new commit with a changed file

  • 1.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

github-change-remote-file

Build StatusCoverage StatusDependency StatusdevDependency Statusjs-standard-style

Note: this is a temporary hack because I needed this to work real quick. It will (? should) eventually land upstream

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 commit:

githubChangeRemoteFile({
  user: 'boennemann',
  repo: 'animals',
  filenames: ['.gitattributes', '.editorconfig']
  transforms: [function (content) {
    return createNewContent(content)
  }, function () {
    return createNewContent(content)
  }],
  token: '<github access token with sufficent rights>'
}, function (err, res) {
  console.log(res.sha) // sha of the new commit
})

Create a new commit and send a PR:

githubChangeRemoteFile({
  user: 'boennemann',
  repo: 'animals',
  filenames: ['.gitattributes', '.editorconfig']
  transforms: [function (content) {
    return createNewContent(content)
  }, function () {
    return createNewContent(content)
  }],
  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
})

Create a new commit and push it on top of the (master) branch:

githubChangeRemoteFile({
  user: 'boennemann',
  repo: 'animals',
  filenames: ['.gitattributes', '.editorconfig']
  transforms: [function (content) {
    return createNewContent(content)
  }, function () {
    return createNewContent(content)
  }],
  token: '<github access token with sufficent rights>',
  push: true
}, function (err, res) {
  console.log(res.object.url) // url of the new commit
})

Keywords

FAQs

Package last updated on 14 Jan 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc