We have a lot of Scriptrunner scripts.
I want a history for those scripts and thought of git. Is there any change to push the whole script to git when I save the script?
Is there an event I can fire or any listener for this?
Thanks for any ideas.
So, there are a couple of different approaches that you could take with this one. Unfortunately, there aren't any ScriptRunner events associated with scripts or the saving/editing of them, so most of making this happen will probably have to be done outside of ScriptRunner.
1. If you're using the script editor for your scripts, you could use something to watch file system events and when changes occur to the scripts, a shell script is run which commits and pushes the updated files. I understand that this may not be ideal as you may not currently be using the script editor for all of your scripts, but it may be worthwhile to have users move those scripts which don't use the script editor.
2. You could have users PR their scripts into a branch on a repo which is a copy of your script root, and you could create a cron job that pulls the changes from the remote repo to the script root on the server every so often.
As you create your solution, it'll probably be helpful to refer to this section of the docs on script version control best practices (this is currently only in our docs for ScriptRunner for Jira but applies to ScriptRunner for Confluence as well): https://scriptrunner.adaptavist.com/latest/jira/script-version-control.html
Also, here's our documentation on script roots: https://scriptrunner.adaptavist.com/6.16.0/confluence/_script_roots.html
Thank you for your answer. I appreciate it!
Both options aren't the perfect match for my wish.
I wished, there was a "Save" Event for ScriptRunner scripts. With the save event, I would then create a REST-call to my existing git project and pull the new content of the script.
Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond. A long time favorite, Team Cale...
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