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

Scriptrunner for Bitbucket: Check file content in commit

Juan Maraboli September 24, 2021

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

Suggest an answer

Log in or Sign up to answer
0 votes
Robert Giddings [Adaptavist]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 19, 2022

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: https://library.adaptavist.com/entity/block-commits-for-files-containing-content-that-doesnt-match-regex

Kind regards,

Robert Giddings,

Product Manager,

ScriptRunner for Bitbucket

0 votes
Robert Giddings [Adaptavist]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 26, 2021

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: https://docs.adaptavist.com/sr4bib/latest/features/script-pre-receive-hooks/built-in-pre-receive-hooks/protect-git-refs

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

0 votes
mark-1003 November 12, 2021

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

0 votes
Sascha SK October 13, 2021

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
Sascha

TAGS
AUG Leaders

Atlassian Community Events