Guest User

Untitled

a guest
Aug 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.22 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2.  
  3. our_secret = "aaaa"
  4.  
  5. params = gets
  6. oldref = params.split()[0]
  7. newref = params.split()[1]
  8. refname = params.split()[2]
  9.  
  10.  
  11.  
  12. changed_files = `git diff --no-commit-id --name-only #{oldref}..#{newref}`
  13.  
  14. if changed_files.include? '.gitlab-ci.yml' then
  15. commit_messages = `git log --pretty=%s #{newref} | head -3`.split("\n")
  16.  
  17. unless commit_messages.include? our_secret
  18. puts "================================================================= "
  19. puts "██████╗ ███████╗ ██╗███████╗ ██████╗████████╗███████╗██████╗ "
  20. puts "██╔══██╗██╔════╝ ██║██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗ "
  21. puts "██████╔╝█████╗ ██║█████╗ ██║ ██║ █████╗ ██║ ██║ "
  22. puts "██╔══██╗██╔══╝ ██ ██║██╔══╝ ██║ ██║ ██╔══╝ ██║ ██║ "
  23. puts "██║ ██║███████╗╚█████╔╝███████╗╚██████╗ ██║ ███████╗██████╔╝ "
  24. puts "╚═╝ ╚═╝╚══════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═════╝ "
  25. puts "================================================================= "
  26. puts ""
  27. puts " oldref is #{oldref}"
  28. puts " newref is #{newref}"
  29. puts " refname is #{refname}"
  30. puts " "
  31. puts " We are very very sorry but your change seems to violate our policies! "
  32. puts " Please check with your nearest Guru! :) ERROR_ID: 001 "
  33. puts "================================================================= "
  34.  
  35. exit 1
  36. end
  37.  
  38. end # if changed_files.include?
  39. exit 0
Add Comment
Please, Sign In to add comment