fix(payload_api, git_diff): Accessing correct property in payload and Replacing --quiet with --no-patch in git diff #1934
+2
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Replacing
github.context.payload.headwithgithub.context.payload.pull_request?.headgithub.context.payload.headis alwaysundefinedand github doc also there is no evidence this exist,So while trying
github.context.payload.pull_request?.headthis returns the expectedheadobject and can propogates toforkand also
forkisbooleannot a string.this is found during why the action reached this
ifblock due to avoidgit merge-baseand seems it could be a accidental mistake2. Replacing
--quietwith--no-patchAs of now, seems every
gitcommands are returning exitcode and if the exit code is none other than 0we are assuming that operation is not completed successfully which is correct but except
git diff --quietwould return exit code0if there are no differences, but returns1if there is any differences.as they mentioned here ,
--quietwould add--exit-code.As they mentioned here.
So seems it not expected, but we have similar flag to run git diff with no outputs, which is
--no-patchThese all are found while try to avoid fetching more histories to save time from the eslint-changed-files action and this is a follow up of tj-actions/eslint-changed-files#1633