ruby - 在 ruby 中使用 octokit 在 github 中检索最新的发布版本和最后 3 个各自的提交
问题描述
我试图自动化 GitHub 流程并获取 ruby 中存储库的最新发布版本名称和各自的最后 3 次提交。我已经使用 octokit gem 来实现这一点。但我无法获得发布版本 ID 或版本名称。谁能帮我解决这个问题?
require 'highline/import'
require 'octokit'
# API
ratelimit = Octokit.ratelimit
ratelimit_remaining = Octokit.ratelimit_remaining
puts "Rate Limit Remaining: #{ratelimit_remaining} / #{ratelimit}"
#authenticates userid and pwd for the github
$userid = ask("Enter your username: ") { |q| q.echo = true }
$passwd = ask("Enter your password: ") { |q| q.echo = "*" }
#client holds the complete github information of that particular user
client = Octokit::Client.new(:login => $userid, :password => $passwd)
#repos hold all the client repositories
repos= client.repositories
#this will fetch the info of the particluar repo
repos1= repos[5]['name']
puts "Last 3 commits for #{repos1} are"
Octokit.list_commits("kvsushma/#{repos1}").first(3).map do |a|
puts " #{a.commit['message']} "
end
这给出了正确的信息。但是当我尝试运行代码以获取最新版本时,它会给出错误。
var releases = client.Repository.Release.GetAll("octokit", "octokit.net");
var latest = releases[0];
Console.WriteLine(
"The latest release is tagged at {0} and is named {1}",
latest.TagName,
latest.Name);
参考链接在此处输入链接描述
解决方案
推荐阅读
- ios - Fullscreen mode is disabled for an embedded YouTube video in WKWebView
- python - 替换字符串中的问题
- php - 将定制的幻灯片添加到 Wordpress 主题
- php - 错误:14094410:SSL 例程:ssl3_read_bytes:sslv3 警报握手失败 PHP curl
- sql - 错误类型错误的 ADODB 命令值
- php - 在 AJAX 调用中显示来自 PHP 的消息
- node.js - 如果不存在,Mongoose.connect 不会创建数据库
- html - 使用 CSS 更改多图像背景中背景图像之一的亮度?
- excel - 如何将一个单元格文本与另一个包含 Excel 中已有文本的单元格连接起来?
- c++ - QDirIterator - 跳过文件夹及其子文件夹