I am trying to capture the output of this git command (or any for that matter).
git diff-tree --no-commit-id --patch-with-raw -r HEAD # HEAD or some commit SHA
However, unlike an echo
, the following command does not log any output in the GitHub actions log. Nor does it streams the output to a variable. On my local, the same command logs the changes made in the last commit.
# result is empty
result=$(git diff-tree --no-commit-id --patch-with-raw -r HEAD)
What am I missing? How do I capture the output of the above git command?
CodePudding user response:
Probably something alike this... in every case with echo
:
echo $(git diff-tree --no-commit-id --patch-with-raw -r HEAD)
CodePudding user response:
Are you using the checkout action to checkout your code? git diff-tree
probably doesn't output anything if you're not fetching the history. Try
- uses: actions/checkout@v2
with:
fetch-depth: 0