Github Workflow Question

Question:

I have been working on a workflow that is able to back up my n8n workflows on github on a specific schedule. After the initial file(s) are made on github, it updates the GitHub file every few days.

However, I want to add a section where it only runs when if an edit has been made to the workflow(s) being backuped up on Github. Does anyone have any ideas as to how to go about this with an if-node (or another node)?

Hey @Josue_Vazquez, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@DC3 - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

To prevent redundant commits, you can fetch the existing file’s SHA from the GitHub API and compare a cryptographic hash of your current workflow JSON against it using an n8n Code node before the If node. If the hashes match, skip the GitHub update node entirely to keep your commit history clean. Let me know what your current GitHub node response structure looks like and I can share the exact snippet for hash comparison right here.

I’d compare the actual file content rather than a normal hash directly against GitHub’s sha. The GitHub value is a Git blob SHA, so it won’t necessarily match a standard hash of the workflow JSON.

A safer flow would be:

  1. Export the current workflow JSON.
  2. Get the existing GitHub file and decode its Base64 content.
  3. Normalize both versions in the same way, for example parse the JSON and serialize it consistently.
  4. Compare the normalized content.
  5. Only send the GitHub update when they differ.

Keep GitHub’s existing file SHA for the update request itself, but use the content comparison to decide whether an update is needed.

I’d also check whether the exported JSON contains metadata that changes without a meaningful workflow edit, otherwise the comparison may still create unnecessary commits.