Script to sync stars

This commit is contained in:
Brandon Keepers
2017-07-28 11:25:41 -05:00
parent c08da09cdf
commit b6ffa4f8ef
8 changed files with 29 additions and 7 deletions

View File

@@ -10,4 +10,8 @@ group :jekyll_plugins do
gem 'jekyll-livereload'
end
group :scripts do
gem 'octokit'
end
gem 'rb-fsevent', '0.9.8' # See issue https://github.com/guard/listen/issues/431

View File

@@ -8,7 +8,7 @@ organizations:
- linuxfoundation
- kubernetes
- nodejs
stars: 142
stars: 19
installs: 48
author: bkeepers
repository: probot/dco

View File

@@ -1,8 +1,8 @@
---
title: Duplicate Issues
description: Identify duplicate issues
description: Automatically detects duplicate issues
slug: dup
stars: 14
stars: 15
installs: 4
author: MarshallOfSound
repository: MarshallOfSound/probot-issue-duplicate-detection

View File

@@ -4,7 +4,7 @@ description: Pull Requests for repository settings
slug: settings
topics:
- administration
stars: 114
stars: 121
installs: 38
author: bkeepers
repository: probot/configurer

View File

@@ -3,7 +3,7 @@ title: Snooze
description: Temporarily close Issues and Pull Requests
slug: snooze
author: jbjonesjr
stars: 2
stars: 3
installs: 5
repository: jbjonesjr/probot-snooze
---

View File

@@ -15,7 +15,7 @@ organizations:
- github
- npm
author: bkeepers
stars: 112
stars: 124
installs: 305
repository: probot/stale
---

View File

@@ -3,7 +3,7 @@ title: Work In Progress
description: Prevent merging of unfinished Pull Requests
slug: wip
author: gr2m
stars: 4
stars: 5
installs: 7
repository: gr2m/wip-bot
---

18
script/sync-stars Executable file
View File

@@ -0,0 +1,18 @@
#!/usr/bin/env ruby
# Sync star counts from GitHub
require "octokit"
client = Octokit::Client.new(:access_token => ENV["GITHUB_TOKEN"])
require "jekyll"
config = Jekyll.configuration("source" => File.expand_path('../', File.dirname(__FILE__)))
site = Jekyll::Site.new(config)
site.read
site.collections["apps"].docs.each do |app|
repo = client.repository(app['repository'])
content = File.read(app.path)
content.sub!(/^stars: \d+$/, "stars: #{repo[:stargazers_count]}")
File.write(app.path, content)
end