Tracking changes on Github file

Good morning! Could you help me please with a valid flow to detect when a file on Github is modified?

I’m actually using the Github trigger with the pull_request event from the webhook but I’m not sure if that’s the best way. I give you a little explain:

With the pull_request event I have to wait to do a merge that actives the trigger and then from an url: I check if that particular file have modifications. This is my actual flow:

This is the expression that I use in the HTTP request to get the content of the diff property


This is the HTTP REQUEST result:

I use this last step to check with the IF node if the result from the HTTP node contents “swagger”. If true, the Github api makes a GET request to get the file swagger.sjon and finally sends an email with the file.


This is the event that I’m using on the Github trigger :


This works but I would like to know if exists a better approach.

Hey @Santiago_Medina_Figu, if you have a working approach my first suggestion usually is to just keep it.

However, if your goal is to simply track changes to a single file (which could technically occur without a pull request if someone were to commit directly to the main/master branch), you might want to store the current sha value of it and simply check if it has changed in regular intervals.

You could use the static workflow data to store (and read) the SHA value, this is described here. Alternatively, you can simply store the SHA value in in any database/file you might already use.

This helped me a lot. Thank you.