Skip to content

Instantly share code, notes, and snippets.

@elrayle
Last active April 29, 2021 14:43
Show Gist options
  • Save elrayle/ea250f74a031639a962309b74f995ff4 to your computer and use it in GitHub Desktop.
Save elrayle/ea250f74a031639a962309b74f995ff4 to your computer and use it in GitHub Desktop.
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