-
I have a GitHub Action set up, which automatically pushes changes from a documentation to the Could an issue be, that Or would I need to first checkout the job again in order to set the env variable first? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments
-
Hi @Andre601, Remove back-ticks could work fine. If remove back-ticks could not work in your scenario. Could you share your whole workflow yml here? |
Beta Was this translation helpful? Give feedback.
-
It does work when removing the backticks, but my point is, that I want to have those backticks to format the sha. If not would I hope that a GitHub dev/employe could look into fixing this rather annoying issue as I see no reason why the variable shouldn’t be translated here. |
Beta Was this translation helpful? Give feedback.
-
The problem is that backticks are part of shell syntax, and bash will try to execute the string between the backticks and substitute the output. Hence the “1503d45: command not found” in the example with backticks posted by @yanjingzhu. Try escaping the backticks by placing backslashes in front of them, like this:
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion. Unfortunately does this not work, because It causes an error: So escaping it won’t really work it seems. Here is my full deploy.yml and the particular part I use to send notifications. purrbot-site/Docs/blob/70f23d54c6154591a8846502782d7b7be5286569/.github/workflows/deploy.yml#L33-L68
This file has been truncated. show original |
Beta Was this translation helpful? Give feedback.
-
Well, a Bash escape sequence isn’t necessarily going to work in JSON. In JSON
isn’t a valid escape sequence. 😉 You should be able to use a literal backtick, but if you really need to escape it you can use a Unicode escape: However, after fixing that you’ll have another problem: The shell variable substitution |
Beta Was this translation helpful? Give feedback.
-
I now tried it without any backticks and even that doesn’t seem to make it translate into the commit-hash. Does it perhaps require a checkout first, or would the checkout from the previous job work as-well? I really want nothing more than using the commit sha inside a Discord webhook while having it in a inline code block, but this entire shell thing messes that up, which is nothing less than annoying. |
Beta Was this translation helpful? Give feedback.
-
I now moved to use |
Beta Was this translation helpful? Give feedback.
I now moved to use
${{github.event.after}}
since those kind of placeholders seem to work no matter what and while it isn’t the result I want (Only first 7 characters of a commit) is it more than good enough for it.