Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner for Bitbucket: Check file content in commit


I am trying to create a script to be able to check if certain files that are committed contain a tab character in the file. I have gotten the code to successfully block commits/pushes if the file name matches, but now that I am trying to dig into the content I continue to get a "path not found error. 

Edit: Issue resolved 

4 answers

Hi @Juan Maraboli , @mark-1003 and @Sascha SK ,

Further to my previous answer, we have now published a Script to our Adaptavist Library that shows an example of blocking commits based on file content.

The Script can be found here:

Kind regards,

Robert Giddings,

Product Manager,

ScriptRunner for Bitbucket

Hi @Juan Maraboli , @mark-1003 , @Sascha SK ,

Thank you for your questions regarding this.

In ScriptRunner for Bitbucket we have an example Snippet showing how to load the contents of a JSON file.

The Snippet can be found on the Snippets of the Protect Git Refs pre-hook:

We are also planning to make examples around file reading more accessible to users, as currently it only exists as a Snippet example from within the product itself.

Please let me know if this helps solve what you wanted to achieve?

Kind regards,

Robert Giddings

I would also be interested in the resolution... would be nice if You could share it!

Hi @Juan Maraboli ,

I have a similar problem to solve. Would you mind sharing your solution with me/us?

Thanks a lot and best regards

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

📅 Partner Webinar & Events Opportunities: July 2022

Hi community 👋, Here is another monthly roundup of the partner-organized events in July 2022. If there is any event missing please let me know in the comments below 🙏 If you're looking for Atla...

23 views 0 2
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you