Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
npm install githubot
Use it in your Hubot script:
module.exports = (robot) ->
github = require('githubot')(robot)
Or use it on its own:
github = require('githubot')
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
If process.env.HUBOT_GITHUB_TOKEN
is present, you're automatically authenticated. Sweet!
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.
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
# Branch from master
gh.branches( "foo/bar" ).create "my_radical_feature", (branch) ->
console.log branch.sha
# Branch from another branch
gh.branches( "foo/bar" ).create "even_more_radical", from: "my_radical_feature", (branch) ->
console.log branch.sha
gh.branches( "foo/bar" ).delete "my_radical_feature", ->
console.log "Deleted my branch!"
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) ->
HUBOT_GITHUB_TOKEN
: GitHub API token. Required to perform authenticated actions.
HUBOT_GITHUB_USER
: Default GitHub username to use if one is not given.
HUBOT_GITHUB_API
: The base API URL. This is useful for Enterprise Github installations.
For example, HUBOT_GITHUB_API='http://myprivate.github.int'
HUBOT_CONCURRENT_REQUESTS
: Limits the allowed number of concurrent requests to the GitHub API. Defaults to 20.
Install the dependencies:
npm install
Run the tests:
make test
make test-all # Runs additional slower "integration" style tests, generally not necessary
Pull requests encouraged!
I'm vastly more likely to merge code that comes with tests. If you're confused by the testing process, ask and I can probably point you in the right direction.
FAQs
Hubot-compatible Github API wrapper for Node.js
The npm package githubot receives a total of 34 weekly downloads. As such, githubot popularity was classified as not popular.
We found that githubot demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.