Get the diff of the changed files #2381
IchordeDionysos
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Hi @IchordeDionysos can you provide some context on what you are trying to achieve in the following format.
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem:
We want to check the actual diff of the files changed instead of just checking which files have changed.
e.g. we want to ensure that only specific changes have been made in a PR before continuing an action step.
More concretely, only approve a release-please PR when only the CHANGELOG.md and only the version has been changed in the PR.
This diff should be accepted:
This should not:
To achieve that it would be cool if the actual diff would be provided as output.
Solutions explored:
Such checks have been integrated into other actions, though those are often quite restrictive and the checks have been done directly in some NodeJS code, see this example:
https://github.com/googleapis/repo-automation-bots/blob/main/packages/auto-approve/src/process-checks/node/release.ts#L52-L63
There is a different action that does provide the diffs as output which could then be used in a follow-up step to analyse the diffs:
git-diff-action
does return that information in such a format:https://github.com/marketplace/actions/git-diff-action#json-diff-output-
e.g.:
Possible solution required to solve the problem:
However, it would be nice to only have to use one action, not multiple ones.
And
changed-files
simply provides a lot more features compared togit-diff-action
.So having some output of the actual diff would be helpful, that you can do:
The syntax can be different
If alternatively it would be possible to let those checks be done by the action that would be even nicer.
Though for a first version, I think a simple output would be enough. Especially if the types of checks people would want to do is not clear yet.
Beta Was this translation helpful? Give feedback.
All reactions