Skip to content

Instantly share code, notes, and snippets.

@mikaelvesavuori
Created January 20, 2023 19:52
Show Gist options
  • Save mikaelvesavuori/3d607d31fe777e2b0f548cc4f4148815 to your computer and use it in GitHub Desktop.
Save mikaelvesavuori/3d607d31fe777e2b0f548cc4f4148815 to your computer and use it in GitHub Desktop.
Get git diff between the current and last commit in GitHub Actions
import { simpleGit } from 'simple-git';
diff(github.context.payload.after, github.context.payload.before);
async function diff(after: string, before: string) {
const git = simpleGit();
const diff = await git.diffSummary([after, before]);
console.log(diff);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment