How do I automatically create an issue in a new GitHub repository?

869 Views Asked by At

I am the admin of a GitHub organization. I have set up a Repository webhook for the organization. I am using ngrok to communicate to a local sinatra instance. Here is my server.rb file:

require 'sinatra'
require 'json'

set :port, 1234

post '/payload' do
  push = JSON.parse(request.body.read)
  puts "I got some JSON: #{push.inspect}"
end

I receive a JSON payload when a repository is created. I would like to automatically create an issue in this new repository with a name and description. I'm assuming I need to use a gem to interact with GitHub API, so I chose octokit. I was able to authenticate, but I'm having trouble seeing how to interact with the API. I would like to create an issue in the newly created GitHub repository. Could I see some examples on ho this is used?

Reference: https://developer.github.com/v3/issues/#create-an-issue

1

There are 1 best solutions below

1
On
Octokit.create_issue("sferik/rails_admin", 'Updated Docs', 'Added some extra links')

http://octokit.github.io/octokit.rb/Octokit/Client/Issues.html#create_issue-instance_method