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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Push to git on saving Scriptrunner script

Dominic Lagger Community Leader Nov 17, 2020

Hi all

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.

Regards, Dominic

1 answer

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

Dominic Lagger Community Leader Jan 08, 2021

Hi @Tiffany Wortham 

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.

Regards, Dominic

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.4.1
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

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...

177 views 0 6
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