Generate File In Pipeline and Check if Any Differences to Existing File

How can I generate a file in my CI pipeline and check if there are any differences to an existing committed file.

My CI pipeline runs on merge requests and already has a few jobs that run in sequence.

In my dev environment, I have a script that I use to generate a GraphQL SDK and I run this on my command line and commit before I make a merge request. However sometimes I forget to do this before pushing code up and it can be a bit of a hassle waiting for the pipeline to fail and then making the changes locally and pushing code up again.

So my idea is to create a job that runs the GraphQL SDK generator script in my pipeline, which will generate a new SDK and produce an error if the generated file is different to the committed file in the MR.

Can anyone please point me in the right direction? I’ve read about jobs but I still can’t find instructions on how to do this specific thing.

Thank you for your help !!:relaxed: