# Automatic flow backups to GitHub

**URL:** <https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238>\
**Category:** Share Your Projects\
**Created:** [12 September 2023 12:12 UTC](https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238 "2023-09-12T12:12:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [12 September 2023 12:12 UTC](https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238/1 "2023-09-12T12:12:09Z")

</div>

Hi There,

I built a flow that automatically commits flow data to GitHub using their API. I needed this since I'm using a disk-less server so I couldn't use the project feature of Node-RED.

For those interested, the flow is [over here](https://flowhub.org/f/c9abaaed2623d0fb) - all requirements and details are described there.

Cheers!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [12 September 2023 15:51 UTC](https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238/2 "2023-09-12T15:51:35Z")

</div>

Cool. 🙂

> The flow can be triggered whenever its required. I haven’t yet found a way of triggering it after a deploy since there isn’t an event triggered after the completion of deployment.

THere is a deploy event. Couldn't you simply track that and then add a small timeout delay? In fact, I think the function fires AFTER the deploy - though I'm not totally certain.

```auto
RED.events.on('deploy', function() {
     console.log('Deployed')
})

```

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [12 September 2023 16:08 UTC](https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238/3 "2023-09-12T16:08:57Z")

</div>

Cheers, didn't see that event in the codebase but can confirm, definitely works 👍

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [13 September 2023 08:46 UTC](https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238/4 "2023-09-13T08:46:28Z")

</div>

Based on that event, here's a [flow](https://flowhub.org/f/54b1b4c46e18fb23) that captures that event and can be used to trigger the GitHub backup. The only problem is that the event listener needs to be installed in the browser. For that the frontend code needs to be "deployed" to the browser - hence an inject needs to be triggered one time.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [14 September 2023 06:56 UTC](https://discourse.nodered.org/t/automatic-flow-backups-to-github/81238/5 "2023-09-14T06:56:28Z")

</div>

One more [flow](https://flowhub.org/f/3586922cb708a29c) for the visual comparison of flow revisions. The flow provides a http endpoint for accessing the last 30 revisions of flow backups and allows comparing any number of them against each other. Comparing exactly two flow revisions activates detailed textual differs for more accurate comparisons.
