Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How do I make a pre-receive hook for Scriptrunner

Hello, I am trying to make a pre-hook using Scriptrunner in Bitbucket. The hook is supposed to check if there is a file named "" whenever a user push, if there is not nothing happens but if there is, the hook check what's inside and compare it with a regex I made. The problem I have is that I can't seems to make it find the file. Here is the code of the hook in groovy :


def regex = ".*requires\\(\"[^\\d|_|\\-](\\S)+/\\[(\\d)(\\.\\d)*\\]@(eca|exail)/stable\""
def fileName = ""

def file = new File(fileName)

if (file.exists()) {
  file.readLines().each { line ->
    if (line.startsWith("self.requires")) {
      if (!(line =~ regex)) {
        log.error("Lorem Ipsum $line")
        return false
  }"All 'self.requires' lines match the regex.")
  return true
} else {
  return true

The code compile but it always says that my file is not existing. Anyone got some tips to help me please ?

0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events