From 9c635f28b0681d4838daca8a343441abfc457bcb Mon Sep 17 00:00:00 2001
From: Razvan Spatariu <razvanspatariu@gmail.com>
Date: Tue, 10 Aug 2021 18:58:42 +0100
Subject: [PATCH 1/4] Add branch option

This is mostly needed for protected branches. If you want to push the diagram to a separate branch, you can pass the branch option. The script will check if that branch exists and push the diagram there or create the branch and push the diagram!
---
 action.yml    |  3 +++
 diagram.svg   |  2 +-
 index.js      | 21 ++++++++++++++++++++-
 src/index.jsx | 27 +++++++++++++++++++++++++--
 4 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/action.yml b/action.yml
index 0da9d08..f0a0c08 100644
--- a/action.yml
+++ b/action.yml
@@ -14,6 +14,9 @@ inputs:
   commit_message:
     description: "The commit message to use when updating the diagram. Default: Repo visualizer: updated diagram"
     required: false
+  branch:
+    description: "If you want to push the diagram to a different branch (branch will be created if it does not exist)"
+    required: false
 runs:
   using: "node12"
   main: "index.js"
diff --git a/diagram.svg b/diagram.svg
index 1a1f836..237fe1c 100644
--- a/diagram.svg
+++ b/diagram.svg
@@ -1 +1 @@
-<svg width="1000" height="1000" style="background:white;font-family:sans-serif;overflow:visible" xmlns="http://www.w3.org/2000/svg"><defs><filter id="glow" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="4" result="coloredBlur"></feGaussianBlur><feMerge><feMergeNode in="coloredBlur"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter></defs><g style="fill:#12B9B1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(437.02866064184605, 333.63277503936393)"><circle r="303.63277503936393" style="transition:all 0.5s ease-out" stroke="#290819" opacity="0.2" stroke-width="1" fill="none"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(392.09880681875444, 718.6929401319774)"><circle r="64.03226742191774" style="transition:all 0.5s ease-out" stroke="#290819" opacity="0.2" stroke-width="1" fill="none"></circle></g><g style="fill:#FDA7DF;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(284.9010586632405, 343.57630731512097)"><circle style="transition:all 0.5s ease-out" r="148.1805493492152" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#12B9B1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(585.298431969213, 345.65724526590486)"><circle style="transition:all 0.5s ease-out" r="148.17067229209044" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#C56BF0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(473.47684228458166, 518.9185690582868)"><circle style="transition:all 0.5s ease-out" r="53.96705064583377" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CE83F1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(492.5951136008534, 168.16291206449262)"><circle style="transition:all 0.5s ease-out" r="48.01118496553003" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#29CBBA;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(380.24494856378004, 169.07103632218863)"><circle style="transition:all 0.5s ease-out" r="46.60356032848418" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#12B9B1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(435.8689523061855, 233.61291059827775)"><circle style="transition:all 0.5s ease-out" r="34.60021502188226" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#29CBBA;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(434.41093648518586, 443.0140309102316)"><circle style="transition:all 0.5s ease-out" r="27.40064767350032" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CE83F1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(618.810798169985, 788.651413418116)"><circle style="transition:all 0.5s ease-out" r="148.1854876309005" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#6473F2;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(811.4406568087522, 793.7041132955007)"><circle style="transition:all 0.5s ease-out" r="40.90018393167728" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(784.2816618412589, 862.038032344211)"><circle style="transition:all 0.5s ease-out" r="28.806710979318023" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#FDA7DF;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(786.2083999716267, 727.6009377003273)"><circle style="transition:all 0.5s ease-out" r="25.974823702072957" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(755.490572401992, 712.6442614896398)"><circle style="transition:all 0.5s ease-out" r="4.190759796363183" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(376.42273740372974, 718.6929401319774)"><circle r="37.676586356407654" style="transition:all 0.5s ease-out" stroke="#290819" opacity="0.2" stroke-width="1" fill="none"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(435.11519900040486, 718.6929401319774)"><circle style="transition:all 0.5s ease-out" r="10.336263589781938" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#badc58;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(372.7857847894407, 718.6929401319774)"><circle style="transition:all 0.5s ease-out" r="29.185264810079737" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(408.0351866798289, 718.6929401319774)"><circle style="transition:all 0.5s ease-out" r="1.2097681482696727" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#FDA7DF;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(284.9010586632405, 343.57630731512097)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">language-colo...</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">language-colo...</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">language-colo...</text></g><g style="fill:#12B9B1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(585.298431969213, 345.65724526590486)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">Tree.tsx</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">Tree.tsx</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">Tree.tsx</text></g><g style="fill:#C56BF0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(473.47684228458166, 518.9185690582868)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">index.jsx</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">index.jsx</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">index.jsx</text></g><g style="fill:#CE83F1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(492.5951136008534, 168.16291206449262)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">process-dir.js</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">process-dir.js</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">process-dir.js</text></g><g style="fill:#29CBBA;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(380.24494856378004, 169.07103632218863)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">utils.ts</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">utils.ts</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">utils.ts</text></g><g style="fill:#12B9B1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(435.8689523061855, 233.61291059827775)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">CircleText.tsx</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">CircleText.tsx</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">CircleText.tsx</text></g><g style="fill:#CE83F1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(618.810798169985, 788.651413418116)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">index.js</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">index.js</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">index.js</text></g><g style="fill:#6473F2;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(811.4406568087522, 793.7041132955007)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">README.md</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">README.md</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">README.md</text></g><g style="pointer-events:none;transition:all 0.5s ease-out" transform="translate(437.02866064184605, 333.63277503936393)"><path fill="none" d="M 0 300.63277503936393 A 300.63277503936393 300.63277503936393 0 0 1 0 -300.63277503936393 A 300.63277503936393 300.63277503936393 0 0 1 0 300.63277503936393" id="CircleText--1" transform="rotate(0)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151" stroke="white" stroke-width="6"><textPath href="#CircleText--1" startOffset="50%">src</textPath></text><path fill="none" d="M 0 300.63277503936393 A 300.63277503936393 300.63277503936393 0 0 1 0 -300.63277503936393 A 300.63277503936393 300.63277503936393 0 0 1 0 300.63277503936393" id="CircleText--2" transform="rotate(0)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151"><textPath href="#CircleText--2" startOffset="50%">src</textPath></text></g><g style="pointer-events:none;transition:all 0.5s ease-out" transform="translate(392.09880681875444, 718.6929401319774)"><path fill="none" d="M 0 61.03226742191774 A 61.03226742191774 61.03226742191774 0 0 1 0 -61.03226742191774 A 61.03226742191774 61.03226742191774 0 0 1 0 61.03226742191774" id="CircleText--3" transform="rotate(0)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151" stroke="white" stroke-width="6"><textPath href="#CircleText--3" startOffset="50%">.husky</textPath></text><path fill="none" d="M 0 61.03226742191774 A 61.03226742191774 61.03226742191774 0 0 1 0 -61.03226742191774 A 61.03226742191774 61.03226742191774 0 0 1 0 61.03226742191774" id="CircleText--4" transform="rotate(0)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151"><textPath href="#CircleText--4" startOffset="50%">.husky</textPath></text></g><g style="pointer-events:none;transition:all 0.5s ease-out" transform="translate(376.42273740372974, 718.6929401319774)"><path fill="none" d="M 0 34.676586356407654 A 34.676586356407654 34.676586356407654 0 0 1 0 -34.676586356407654 A 34.676586356407654 34.676586356407654 0 0 1 0 34.676586356407654" id="CircleText--5" transform="rotate(0)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151" stroke="white" stroke-width="6"><textPath href="#CircleText--5" startOffset="50%">_</textPath></text><path fill="none" d="M 0 34.676586356407654 A 34.676586356407654 34.676586356407654 0 0 1 0 -34.676586356407654 A 34.676586356407654 34.676586356407654 0 0 1 0 34.676586356407654" id="CircleText--6" transform="rotate(0)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151"><textPath href="#CircleText--6" startOffset="50%">_</textPath></text></g><g transform="translate(920, 875)"><g transform="translate(0, 0)"><circle r="5" fill="#CE83F1"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.js</text></g><g transform="translate(0, 15)"><circle r="5" fill="#FDA7DF"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.json</text></g><g transform="translate(0, 30)"><circle r="5" fill="#C56BF0"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.jsx</text></g><g transform="translate(0, 45)"><circle r="5" fill="#6473F2"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.md</text></g><g transform="translate(0, 60)"><circle r="5" fill="#badc58"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.sh</text></g><g transform="translate(0, 75)"><circle r="5" fill="#29CBBA"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.ts</text></g><g transform="translate(0, 90)"><circle r="5" fill="#12B9B1"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.tsx</text></g><div class="w-20 whitespace-nowrap text-sm text-gray-500 font-light italic">each dot sized by file size</div></g></svg>
\ No newline at end of file
+<svg width="1000" height="1000" style="background:white;font-family:sans-serif;overflow:visible" xmlns="http://www.w3.org/2000/svg"><defs><filter id="glow" x="-50%" y="-50%" width="200%" height="200%"><feGaussianBlur stdDeviation="4" result="coloredBlur"></feGaussianBlur><feMerge><feMergeNode in="coloredBlur"></feMergeNode><feMergeNode in="SourceGraphic"></feMergeNode></feMerge></filter></defs><g style="fill:#0060ac;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(317.2530249302622, 551.2730531399869)"><circle r="300.3452359229901" style="transition:all 0.5s ease-out" stroke="#290819" stroke-opacity="0.2" stroke-width="1" fill="white"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(691.8573006749033, 630.5671285235633)"><circle r="66.49304070060681" style="transition:all 0.5s ease-out" stroke="#290819" stroke-opacity="0.2" stroke-width="1" fill="white"></circle></g><g style="fill:#292929;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(168.25043508578563, 553.010471437478)"><circle style="transition:all 0.5s ease-out" r="146.53672500601428" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#0060ac;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(464.6241861753147, 551.6018732634146)"><circle style="transition:all 0.5s ease-out" r="146.52695751891756" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#f1e05a;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(354.830025156826, 733.5362646136706)"><circle style="transition:all 0.5s ease-out" r="62.63425906290593" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#f1e05a;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(315.8273394115071, 422.18048042672956)"><circle style="transition:all 0.5s ease-out" r="47.47857825743729" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#0060ac;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(234.57625207484742, 367.43064215199854)"><circle style="transition:all 0.5s ease-out" r="47.297361648638415" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#0060ac;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(391.8104969377326, 380.9911863245545)"><circle style="transition:all 0.5s ease-out" r="35.75058526557807" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#0060ac;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(316.86612575770704, 648.713496220622)"><circle style="transition:all 0.5s ease-out" r="27.096681654593063" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#f1e05a;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(751.4364997409504, 372.08633686270724)"><circle style="transition:all 0.5s ease-out" r="146.551375016049" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#083fa1;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(951.16472766608, 372.1580444317541)"><circle style="transition:all 0.5s ease-out" r="45.82183566290255" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(913.4231527251673, 469.39735698616096)"><circle style="transition:all 0.5s ease-out" r="39.13355618401647" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#cb171e;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(920.4866892737139, 291.0974230417421)"><circle style="transition:all 0.5s ease-out" r="37.66120866319875" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#292929;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(872.4436558202536, 244.96826912706726)"><circle style="transition:all 0.5s ease-out" r="25.74233406765505" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#ff9900;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(907.5536852817604, 415.121327643953)"><circle style="transition:all 0.5s ease-out" r="12.258916192844012" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#000000;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(876.3636318561169, 282.20603640299925)"><circle style="transition:all 0.5s ease-out" r="4.144270071496971" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#000000;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(675.3250216570041, 630.5671285235633)"><circle r="37.339402459406585" style="transition:all 0.5s ease-out" stroke="#290819" stroke-opacity="0.2" stroke-width="1" fill="white"></circle></g><g style="fill:#CED6E0;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(735.5073827459604, 630.5671285235633)"><circle style="transition:all 0.5s ease-out" r="10.221599406248766" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#89e051;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(671.701489470298, 630.5671285235633)"><circle style="transition:all 0.5s ease-out" r="28.861501340661693" stroke-width="0" stroke="#374151"></circle></g><g style="fill:#000000;transition:transform 0s ease-out, fill 0.1s ease-out" transform="translate(706.6137074636852, 630.5671285235633)"><circle style="transition:all 0.5s ease-out" r="1.1963477206866426" stroke-width="0" stroke="#374151"></circle></g><g style="pointer-events:none;transition:all 0.5s ease-out" transform="translate(317.2530249302622, 551.2730531399869)"><path fill="none" d="M 0 305.3452359229901 A 305.3452359229901 305.3452359229901 0 0 1 0 -305.3452359229901 A 305.3452359229901 305.3452359229901 0 0 1 0 305.3452359229901" id="CircleText--1" transform="rotate(1)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:15px;transition:all 0.5s ease-out" fill="#374151" stroke="white" stroke-width="6"><textPath href="#CircleText--1" startOffset="50%">src</textPath></text><path fill="none" d="M 0 305.3452359229901 A 305.3452359229901 305.3452359229901 0 0 1 0 -305.3452359229901 A 305.3452359229901 305.3452359229901 0 0 1 0 305.3452359229901" id="CircleText--2" transform="rotate(1)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:15px;transition:all 0.5s ease-out" fill="#374151"><textPath href="#CircleText--2" startOffset="50%">src</textPath></text></g><g style="pointer-events:none;transition:all 0.5s ease-out" transform="translate(691.8573006749033, 630.5671285235633)"><path fill="none" d="M 0 71.49304070060681 A 71.49304070060681 71.49304070060681 0 0 1 0 -71.49304070060681 A 71.49304070060681 71.49304070060681 0 0 1 0 71.49304070060681" id="CircleText--3" transform="rotate(1)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:15px;transition:all 0.5s ease-out" fill="#374151" stroke="white" stroke-width="6"><textPath href="#CircleText--3" startOffset="50%">.husky</textPath></text><path fill="none" d="M 0 71.49304070060681 A 71.49304070060681 71.49304070060681 0 0 1 0 -71.49304070060681 A 71.49304070060681 71.49304070060681 0 0 1 0 71.49304070060681" id="CircleText--4" transform="rotate(1)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:15px;transition:all 0.5s ease-out" fill="#374151"><textPath href="#CircleText--4" startOffset="50%">.husky</textPath></text></g><g style="pointer-events:none;transition:all 0.5s ease-out" transform="translate(675.3250216570041, 630.5671285235633)"><path fill="none" d="M 0 38.339402459406585 A 38.339402459406585 38.339402459406585 0 0 1 0 -38.339402459406585 A 38.339402459406585 38.339402459406585 0 0 1 0 38.339402459406585" id="CircleText--5" transform="rotate(2)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151" stroke="white" stroke-width="6"><textPath href="#CircleText--5" startOffset="50%">_</textPath></text><path fill="none" d="M 0 38.339402459406585 A 38.339402459406585 38.339402459406585 0 0 1 0 -38.339402459406585 A 38.339402459406585 38.339402459406585 0 0 1 0 38.339402459406585" id="CircleText--6" transform="rotate(2)" style="pointer-events:none"></path><text text-anchor="middle" style="font-size:14px;transition:all 0.5s ease-out" fill="#374151"><textPath href="#CircleText--6" startOffset="50%">_</textPath></text></g><g style="fill:#292929;transition:transform 0s ease-out" transform="translate(168.25043508578563, 553.010471437478)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">language-colors.json</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">language-colors.json</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">language-colors.json</text></g><g style="fill:#0060ac;transition:transform 0s ease-out" transform="translate(464.6241861753147, 551.6018732634146)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">Tree.tsx</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">Tree.tsx</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">Tree.tsx</text></g><g style="fill:#f1e05a;transition:transform 0s ease-out" transform="translate(354.830025156826, 733.5362646136706)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">index.jsx</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">index.jsx</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">index.jsx</text></g><g style="fill:#f1e05a;transition:transform 0s ease-out" transform="translate(315.8273394115071, 422.18048042672956)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">process-dir.js</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">process-dir.js</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">process-dir.js</text></g><g style="fill:#0060ac;transition:transform 0s ease-out" transform="translate(234.57625207484742, 367.43064215199854)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">utils.ts</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">utils.ts</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">utils.ts</text></g><g style="fill:#0060ac;transition:transform 0s ease-out" transform="translate(391.8104969377326, 380.9911863245545)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">CircleText.tsx</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">CircleText.tsx</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">CircleText.tsx</text></g><g style="fill:#0060ac;transition:transform 0s ease-out" transform="translate(316.86612575770704, 648.713496220622)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">types.ts</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">types.ts</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">types.ts</text></g><g style="fill:#f1e05a;transition:transform 0s ease-out" transform="translate(751.4364997409504, 372.08633686270724)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">index.js</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">index.js</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">index.js</text></g><g style="fill:#083fa1;transition:transform 0s ease-out" transform="translate(951.16472766608, 372.1580444317541)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">README.md</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">README.md</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">README.md</text></g><g style="fill:#CED6E0;transition:transform 0s ease-out" transform="translate(913.4231527251673, 469.39735698616096)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">LICENSE</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">LICENSE</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">LICENSE</text></g><g style="fill:#cb171e;transition:transform 0s ease-out" transform="translate(920.4866892737139, 291.0974230417421)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">action.yml</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">action.yml</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">action.yml</text></g><g style="fill:#292929;transition:transform 0s ease-out" transform="translate(872.4436558202536, 244.96826912706726)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">package.json</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">package.json</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">package.json</text></g><g style="fill:#89e051;transition:transform 0s ease-out" transform="translate(671.701489470298, 630.5671285235633)"><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;transition:all 0.5s ease-out" fill="#4B5563" text-anchor="middle" dominant-baseline="middle" stroke="white" stroke-width="3" stroke-linejoin="round">husky.sh</text><text style="pointer-events:none;opacity:1;font-size:14px;font-weight:500;transition:all 0.5s ease-out" text-anchor="middle" dominant-baseline="middle">husky.sh</text><text style="pointer-events:none;opacity:0.9;font-size:14px;font-weight:500;mix-blend-mode:color-burn;transition:all 0.5s ease-out" fill="#110101" text-anchor="middle" dominant-baseline="middle">husky.sh</text></g><g transform="translate(940, 830)"><g transform="translate(0, 0)"><circle r="5" fill="#000000"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.gitignore</text></g><g transform="translate(0, 15)"><circle r="5" fill="#f1e05a"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.js</text></g><g transform="translate(0, 30)"><circle r="5" fill="#292929"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.json</text></g><g transform="translate(0, 45)"><circle r="5" fill="#f1e05a"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.jsx</text></g><g transform="translate(0, 60)"><circle r="5" fill="#083fa1"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.md</text></g><g transform="translate(0, 75)"><circle r="5" fill="#89e051"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.sh</text></g><g transform="translate(0, 90)"><circle r="5" fill="#ff9900"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.svg</text></g><g transform="translate(0, 105)"><circle r="5" fill="#0060ac"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.ts</text></g><g transform="translate(0, 120)"><circle r="5" fill="#0060ac"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.tsx</text></g><g transform="translate(0, 135)"><circle r="5" fill="#cb171e"></circle><text x="10" style="font-size:14px;font-weight:300" dominant-baseline="middle">.yml</text></g><g fill="#9CA3AF" style="font-weight:300;font-style:italic;font-size:12px">each dot sized by file size</g></g></svg>
\ No newline at end of file
diff --git a/index.js b/index.js
index 96b5fb4..bfde8ff 100644
--- a/index.js
+++ b/index.js
@@ -17919,6 +17919,7 @@ var main = async () => {
   const commitMessage = core.getInput("commit_message") || "Repo visualizer: updated diagram";
   const excludedPathsString = core.getInput("excluded_paths") || "node_modules,bower_components,dist,out,build,eject,.next,.netlify,.yarn,.git,.vscode,package-lock.json,yarn.lock";
   const excludedPaths = excludedPathsString.split(",").map((str) => str.trim());
+  const branch = core.getInput("branch");
   const data = await processDir(`./`, excludedPaths);
   const componentCodeString = import_server.default.renderToStaticMarkup(/* @__PURE__ */ import_react3.default.createElement(Tree, {
     data,
@@ -17927,6 +17928,17 @@ var main = async () => {
   }));
   const outputFile = core.getInput("output_file") || "./diagram.svg";
   await import_fs2.default.writeFileSync(outputFile, componentCodeString);
+  let branchExists = true;
+  if (branch) {
+    await (0, import_exec.exec)("git", ["fetch"]);
+    try {
+      await (0, import_exec.exec)("git", ["rev-parse", "--verify", branch]);
+      await (0, import_exec.exec)("git", ["checkout", branch]);
+    } catch {
+      branchExists = false;
+      await (0, import_exec.exec)("git", ["checkout", "-b", branch]);
+    }
+  }
   await (0, import_exec.exec)("git", ["add", outputFile]);
   const diff = await execWithOutput("git", ["status", "--porcelain", outputFile]);
   core.info(`diff: ${diff}`);
@@ -17935,7 +17947,14 @@ var main = async () => {
     return;
   }
   await (0, import_exec.exec)("git", ["commit", "-m", commitMessage]);
-  await (0, import_exec.exec)("git", ["push"]);
+  if (branchExists) {
+    await (0, import_exec.exec)("git", ["push"]);
+  } else {
+    await (0, import_exec.exec)("git", ["push", "--set-upstream", "origin", branch]);
+  }
+  if (branch) {
+    await (0, import_exec.exec)("git", "checkout", "-");
+  }
   console.log("All set!");
 };
 main();
diff --git a/src/index.jsx b/src/index.jsx
index 5887f00..a5067b1 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -27,6 +27,7 @@ const main = async () => {
   const commitMessage = core.getInput("commit_message") || "Repo visualizer: updated diagram"
   const excludedPathsString = core.getInput("excluded_paths") || "node_modules,bower_components,dist,out,build,eject,.next,.netlify,.yarn,.git,.vscode,package-lock.json,yarn.lock"
   const excludedPaths = excludedPathsString.split(",").map(str => str.trim())
+  const branch = core.getInput("branch")
   const data = await processDir(`./`, excludedPaths);
 
   const componentCodeString = ReactDOMServer.renderToStaticMarkup(
@@ -37,6 +38,20 @@ const main = async () => {
 
   await fs.writeFileSync(outputFile, componentCodeString)
 
+  let branchExists = true
+
+  if (branch) {
+    await exec('git', ['fetch'])
+
+    try {
+      await exec('git', ['rev-parse', '--verify', branch])
+      await exec('git', ['checkout', branch])
+    } catch {
+      branchExists = false
+      await exec('git', ['checkout', '-b', branch])
+    }
+  }
+
   await exec('git', ['add', outputFile])
   const diff = await execWithOutput('git', ['status', '--porcelain', outputFile])
   core.info(`diff: ${diff}`)
@@ -46,7 +61,16 @@ const main = async () => {
   }
 
   await exec('git', ['commit', '-m', commitMessage])
-  await exec('git', ['push'])
+
+  if (branchExists) {
+    await exec('git', ['push'])
+  } else {
+    await exec('git', ['push', '--set-upstream', 'origin', branch])
+  }
+
+  if (branch) {
+    await exec('git', 'checkout', '-')
+  }
 
   console.log("All set!")
 }
@@ -73,4 +97,3 @@ function execWithOutput(command, args) {
     }
   })
 }
-

From 91c3d3cb09aadda9878a034caefe7dc5872092b3 Mon Sep 17 00:00:00 2001
From: repo-visualizer <repo-visualizer@users.noreply.github.com>
Date: Tue, 10 Aug 2021 16:48:17 -0400
Subject: [PATCH 2/4] update branchExists var name

---
 index.js      | 6 +++---
 src/index.jsx | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/index.js b/index.js
index bfde8ff..031c6fc 100644
--- a/index.js
+++ b/index.js
@@ -17928,14 +17928,14 @@ var main = async () => {
   }));
   const outputFile = core.getInput("output_file") || "./diagram.svg";
   await import_fs2.default.writeFileSync(outputFile, componentCodeString);
-  let branchExists = true;
+  let doesBranchExist = true;
   if (branch) {
     await (0, import_exec.exec)("git", ["fetch"]);
     try {
       await (0, import_exec.exec)("git", ["rev-parse", "--verify", branch]);
       await (0, import_exec.exec)("git", ["checkout", branch]);
     } catch {
-      branchExists = false;
+      doesBranchExist = false;
       await (0, import_exec.exec)("git", ["checkout", "-b", branch]);
     }
   }
@@ -17947,7 +17947,7 @@ var main = async () => {
     return;
   }
   await (0, import_exec.exec)("git", ["commit", "-m", commitMessage]);
-  if (branchExists) {
+  if (doesBranchExist) {
     await (0, import_exec.exec)("git", ["push"]);
   } else {
     await (0, import_exec.exec)("git", ["push", "--set-upstream", "origin", branch]);
diff --git a/src/index.jsx b/src/index.jsx
index a5067b1..0ea091f 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -38,7 +38,7 @@ const main = async () => {
 
   await fs.writeFileSync(outputFile, componentCodeString)
 
-  let branchExists = true
+  let doesBranchExist = true
 
   if (branch) {
     await exec('git', ['fetch'])
@@ -47,7 +47,7 @@ const main = async () => {
       await exec('git', ['rev-parse', '--verify', branch])
       await exec('git', ['checkout', branch])
     } catch {
-      branchExists = false
+      doesBranchExist = false
       await exec('git', ['checkout', '-b', branch])
     }
   }
@@ -62,7 +62,7 @@ const main = async () => {
 
   await exec('git', ['commit', '-m', commitMessage])
 
-  if (branchExists) {
+  if (doesBranchExist) {
     await exec('git', ['push'])
   } else {
     await exec('git', ['push', '--set-upstream', 'origin', branch])

From f68a97bb89e1a4926c489f2e5e24b0e1702481c7 Mon Sep 17 00:00:00 2001
From: repo-visualizer <repo-visualizer@users.noreply.github.com>
Date: Tue, 10 Aug 2021 16:48:32 -0400
Subject: [PATCH 3/4] add log for creating new branch

---
 index.js      | 1 +
 src/index.jsx | 1 +
 2 files changed, 2 insertions(+)

diff --git a/index.js b/index.js
index 031c6fc..fb6b314 100644
--- a/index.js
+++ b/index.js
@@ -17936,6 +17936,7 @@ var main = async () => {
       await (0, import_exec.exec)("git", ["checkout", branch]);
     } catch {
       doesBranchExist = false;
+      core.info(`Branch ${branch} does not yet exist, creating ${branch}.`);
       await (0, import_exec.exec)("git", ["checkout", "-b", branch]);
     }
   }
diff --git a/src/index.jsx b/src/index.jsx
index 0ea091f..f2cdf36 100644
--- a/src/index.jsx
+++ b/src/index.jsx
@@ -48,6 +48,7 @@ const main = async () => {
       await exec('git', ['checkout', branch])
     } catch {
       doesBranchExist = false
+      core.info(`Branch ${branch} does not yet exist, creating ${branch}.`)
       await exec('git', ['checkout', '-b', branch])
     }
   }

From d2498629994d7251f0645f2219d2c3dd7ee2c238 Mon Sep 17 00:00:00 2001
From: repo-visualizer <repo-visualizer@users.noreply.github.com>
Date: Tue, 10 Aug 2021 16:50:04 -0400
Subject: [PATCH 4/4] add branch param to docs

---
 README.md  | 6 ++++++
 action.yml | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index af2f86f..a417dfa 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,12 @@ The commit message to use when updating the diagram. Useful for skipping CI. For
 
 Default: `Repo visualizer: updated diagram`
 
+## `branch`
+
+The branch name to push the diagram to (branch will be created if it does not yet exist).
+
+For example: `diagram`
+
 ## Example usage
 
 You'll need to run the `actions/checkout` Action beforehand, to check out the code.
diff --git a/action.yml b/action.yml
index f0a0c08..bf7de2d 100644
--- a/action.yml
+++ b/action.yml
@@ -15,7 +15,7 @@ inputs:
     description: "The commit message to use when updating the diagram. Default: Repo visualizer: updated diagram"
     required: false
   branch:
-    description: "If you want to push the diagram to a different branch (branch will be created if it does not exist)"
+    description: "The branch name to push the diagram to (branch will be created if it does not yet exist). For example: diagram"
     required: false
 runs:
   using: "node12"
