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

githubot

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

githubot

Hubot-compatible Github API wrapper for Node.js

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44
decreased by-49.43%
Maintainers
1
Weekly downloads
 
Created
Source

A Hubot-compatible Github API wrapper for Node.js

Build Status

Install

npm install githubot

Require

Use it in your Hubot script:

module.exports = (robot) ->
  github = require('githubot')(robot)

Or use it on its own:

github = require('githubot')

Use

Make any call to the Github v3 API, get the parsed JSON response:

github.get "https://api.github.com/users/iangreenleaf/gists", (gists) ->
  console.log gists[0].description

github.get "users/foo/repos", {type: "owner"}, (repos) ->
  console.log repos[0].url

data = { description: "A test gist", public: true, files: { "abc.txt": { content: "abcdefg" } } }
github.post "gists", data, (gist) ->
  console.log gist.url

Authentication

If process.env.HUBOT_GITHUB_TOKEN is present, you're automatically authenticated. Sweet!

Acquire a token

If you don't have a token yet, run this:

curl -i https://api.github.com/authorizations -d '{"scopes":["repo"]}' -u "yourusername"

Enter your Github password when prompted. When you get a response, look for the "token" value.

Bespoke API access

Mostly a work in progress, but here's a taste of what I have in mind:

gh.branches "foo/bar", (branches) ->
  console.log branches[0].name

Helpful Hubot

Hubot will log errors if a request fails.

If process.env.HUBOT_GITHUB_USER is present, we can help you guess a repo's full name:

github.qualified_repo "githubot" # => "iangreenleaf/githubot"

This will happen with the bespoke methods as well:

gh.branches "githubot", (branches) ->

FAQs

Package last updated on 02 Jun 2012

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