oe / sourcetree-custom-actions

useful sourcetree custom actions bash scripts
MIT License
4 stars 1 forks source link

Is there a way to install all these custom actions without going through the manual clicks on SourceTree? #1

Open digiajay opened 2 months ago

digiajay commented 2 months ago

Hi

I'm looking for adding the custom actions that can be installed in multiple machines. I don't want each user to go through the steps of going to Options menu and adding each custom actions, is there a way to write bash script for this purpose?

OS: Windows 10

Regards,

oe commented 2 months ago

Good idea! Let me see if there is a feasible method.

oe commented 2 months ago

In MacOS, the configuration of actions is located in ~/Library/Application Support/SourceTree/actions.plist, but it can't be changed easily with the shell.

There should be a similar file in Windows, but I don't have one at hand. You can make a PR if possible.

digiajay commented 2 months ago

Found a C:\Users\[User Folder]\AppData\Local\Atlassian\SourceTree\customactions.xml that actually has all custom actions in the format below.

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfCustomAction xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CustomAction>
    <Caption>Prune Tags</Caption>
    <Target>C:\Users\[User Folder]\Downloads\git prune.bat</Target>
    <OpenInSeparateWindow>false</OpenInSeparateWindow>
    <ShowFullOutput>true</ShowFullOutput>
    <IsSilent>false</IsSilent>
  </CustomAction>
  <CustomAction>
    <Caption>Git Tag - Fix</Caption>
    <Target>\\EI-Data1\Users3\[User Folder]\My Documents\git tag fix.bat</Target>
    <Parameters>$SHA</Parameters>
    <OpenInSeparateWindow>true</OpenInSeparateWindow>
    <ShowFullOutput>true</ShowFullOutput>
    <IsSilent>false</IsSilent>
  </CustomAction>
</ArrayOfCustomAction>
oe commented 2 months ago

It looks like on Windows, the configuration file can be easily modified using a scripting language( Javascript, Python, php, etc.)