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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.