-
-
Save Shinya131/b35f569629275e011d99 to your computer and use it in GitHub Desktop.
許可されたAuther以外行ったコミットを出力
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'git' | |
RIPO_PATH = '/Users/xxxx_xxxx/xxxxxxxx' | |
BRANCH = 'develop' | |
LOG_COUNT = 1000 | |
SINCE = '2 days ago' | |
ALLOWED_AUTHER_NAMES = ['aaa', 'bbb', 'ccc'] | |
# 調査対象のコミットを取ってくる | |
def survey_target_commits | |
g = Git.open(RIPO_PATH) | |
g.checkout(BRANCH) | |
g.log(LOG_COUNT).since(SINCE) | |
end | |
# 調査対象のコミットから、許可されていないAutherによるコミットを取ってくる | |
def denied_auther_commits | |
survey_target_commits.select do |commit| | |
denied_auther_commit?(commit) | |
end | |
end | |
# ALLOWED_AUTHER以外のコミットだったらtrue | |
def denied_auther_commit?(commit) | |
!ALLOWED_AUTHER_NAMES.include?(commit.author.name) | |
end | |
# 適当に表示 | |
denied_auther_commits.each do |commit| | |
print "#{commit.sha},#{commit.author.name},#{commit.date}," | |
p commit.message | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment