Commit 34c9d32
authored
Fix shell quoting in coverage-comment workflow (#845)
The "Resolve PR number" step embedded the event JSON via
`<<<'${{ toJson(github.event) }}'`. Actions performs the `${{...}}`
interpolation *before* bash parses the script, so the single-quoted
heredoc string contained the entire raw event payload inline. As
soon as the payload contained a single quote — e.g. an apostrophe
in a commit message, branch name, or any string field — bash's
'...' quoting closed early and the rest of the step's body became
malformed, producing the GitHub-Actions error:
syntax error near unexpected token `else`
(reported against the assembled temp script's line number, not the
workflow file's). The first PR opened after the coverage workflow
landed happened to have such a quote.
Pass the JSON via an environment variable instead. The shell sees
only `"$EVENT_JSON"`, which is safe regardless of what characters
the payload contains. Add a comment recording the failure mode so
no future maintainer reintroduces the inline-interpolation pattern.1 parent f94ceca commit 34c9d32
1 file changed
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
122 | 134 | | |
123 | 135 | | |
124 | 136 | | |
125 | 137 | | |
126 | 138 | | |
127 | 139 | | |
128 | | - | |
| 140 | + | |
129 | 141 | | |
130 | 142 | | |
131 | 143 | | |
| |||
0 commit comments