Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- our_secret = "aaaa"
- params = gets
- oldref = params.split()[0]
- newref = params.split()[1]
- refname = params.split()[2]
- changed_files = `git diff --no-commit-id --name-only #{oldref}..#{newref}`
- if changed_files.include? '.gitlab-ci.yml' then
- commit_messages = `git log --pretty=%s #{newref} | head -3`.split("\n")
- unless commit_messages.include? our_secret
- puts "================================================================= "
- puts "██████╗ ███████╗ ██╗███████╗ ██████╗████████╗███████╗██████╗ "
- puts "██╔══██╗██╔════╝ ██║██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗ "
- puts "██████╔╝█████╗ ██║█████╗ ██║ ██║ █████╗ ██║ ██║ "
- puts "██╔══██╗██╔══╝ ██ ██║██╔══╝ ██║ ██║ ██╔══╝ ██║ ██║ "
- puts "██║ ██║███████╗╚█████╔╝███████╗╚██████╗ ██║ ███████╗██████╔╝ "
- puts "╚═╝ ╚═╝╚══════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═════╝ "
- puts "================================================================= "
- puts ""
- puts " oldref is #{oldref}"
- puts " newref is #{newref}"
- puts " refname is #{refname}"
- puts " "
- puts " We are very very sorry but your change seems to violate our policies! "
- puts " Please check with your nearest Guru! :) ERROR_ID: 001 "
- puts "================================================================= "
- exit 1
- end
- end # if changed_files.include?
- exit 0
Add Comment
Please, Sign In to add comment