Hi... I made a script that downloads files from Github and then I have scheduled a cron job for each of my scripts and everything is running fine.
But then the problem is if I add any new file to my Github. It is downloaded onto my local server but unfortunately I will have to come to NodeRed again and add blocks to run that newly downloaded script.
Is there any way to automate this process ? where in nodered directly fetches the newly downloaded file and runs it ?
Possibly better to use git to locally clone the repo. change the cron job to do a git pull then all the files will be local and you can use a simple script or one of the filing system nodes to walk through them.
With it you can clone a github repository to a local folder. You do that by hand just once.
Then, you can update it with a git pull command. Any new or changed files will be pulled down and any deleted files removed. You can run the pull command from an exec node.
Then you can run any script in the repo. To run them all, there are nodes that will get all of the files in a folder and you can pass each file name to an exec node to run them.
All tasks u mentioned were already automated by me. The part I want is as soon as a new script is downloaded through git pull NOdeRed should automatically create a flow(without us creating a flow in NodeRed ) to run this newly downloaded script. That is my scope
I believe that you can use the Admin API to do that, but it is much better, unless you have an unusual requirement, to make a general purpose flow which uses data to decide what to do, so it is not necessary to make a new flow. Please explain in more detail what would be in the new flow that you would create.
If you want to do that, you will need to look at GitHub actions and get GitHub to connect to Node-RED when the repo updates.
Really, you are looking in the wrong place. You need something like Azure Logic Apps or Microsoft Power Automate, possibly even IFTTT so that a GitHub action can connect to something that updates data that in turn updates your flowchart.
Node-RED can do it but this isn't an especially simple task to set up and it needs a fair bit of knowledge to get the different tools to talk to each other.