I have a weird problem using Github’s actions. I have a Gradle task that prints release notes to file (it works perfectly fine locally). But using GitHub actions it seems like I cannot use the –pretty=format:
flag for git log
. For an unknown reason, it doesn’t print anything. It works when I remove this flag or when I set it to something without quotation marks. Maybe it’s a problem with escaping those characters? Nevertheless, it’s super weird.
And no it’s not a problem with fetch-depth
. It is set to 0, the history is correct.
When I run it like that (outside from Gradle task):
run: |-
git log develop --no-merges --date=short --pretty=format:"%ad %an: %s" v1.0.0...HEAD
it works as well. It only doesn’t work with the Gradle task inside Github action.
Example run: https://github.com/JakubMosakowski/ItemistEvolved/actions/runs/350396754
There are plenty of similar runs because I was trying everything to check where the problem is.
To be even more precise. This command inside the Gradle task does work:
printf("git log develop --no-merges --date=short --pretty=oneline ${tag}...HEAD".execute().text.trim())
and it doesn’t:
printf("git log develop --no-merges --date=short --pretty=\"%ad %an: %s\" ${getNewestTag()}...HEAD".execute().text.trim())
After changing my runner from Linux to windows it started to work (locally I use windows).
I assume that Linux runnable works differently with escape characters. It probably ends up with an error when I put " or % signs inside a command.