【问题标题】:How do I automatically create an issue in a new GitHub repository?如何在新的 GitHub 存储库中自动创建问题?
【发布时间】:2018-11-25 23:50:02
【问题描述】:

我是 GitHub 组织的管理员。我已经为组织设置了一个 Repository webhook。我正在使用 ngrok 与本地 sinatra 实例进行通信。这是我的 server.rb 文件:

require 'sinatra'
require 'json'

set :port, 1234

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

我在创建存储库时收到 JSON 有效负载。我想在这个新存储库中自动创建一个带有名称和描述的问题。我假设我需要使用 gem 来与 GitHub API 交互,所以我选择了 octokit。我能够进行身份验证,但无法查看如何与 API 交互。我想在新创建的 GitHub 存储库中创建一个问题。我可以看看一些关于这个使用的例子吗?

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

【问题讨论】:

    标签: ruby github octokit


    【解决方案1】:
    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

    【讨论】:

    • 感谢您的链接。我收到了 404。我猜这与我的身份验证有关。有任何想法吗? Octokit::NotFound - GET https://api.github.com/authorizations/99: 404 - Not Found##loginclient = Octokit::Client.new(:login => 'username', :password => 'password')client.authorization(99)## create an issue in new repo with @mentionOctokit.create_issue("CodeAvenger07Organization/test", "New issue", "take a look @codeavenger07")
    猜你喜欢
    • 2020-11-30
    • 2012-04-01
    • 1970-01-01
    • 2015-04-07
    • 2019-03-21
    • 2016-02-27
    • 2017-08-09
    • 2013-11-03
    • 2019-11-09
    相关资源
    最近更新 更多