Last active
April 29, 2021 14:43
-
-
Save elrayle/ea250f74a031639a962309b74f995ff4 to your computer and use it in GitHub Desktop.
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
payload = Hook['params'] | |
branch_name = payload['ref'] | |
repo_name = payload['repository']['fullname'] | |
status = branch_name == "master" ? "BAD" : "GOOD" | |
puts "#{status} branch name #{branch_name}" | |
if status == "BAD" | |
puts "Deleting master branch from #{repo_name}" | |
require 'octokit' | |
# github_token = ARGV[1] | |
# client = Octokit::Client.new({ access_token: github_token }); | |
# client.delete_branch(repo_name, "master") rescue nil | |
# puts "master branch was deleted" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment