Skip to content

Commit

Permalink
BUG: rm quotes (') from around env-var values
Browse files Browse the repository at this point in the history
because GitHub Actions inserts the quotes in
the values of the environment variables that
are created from the assignments that are
printed by the script `setup_shell_env.py`.

For example, the line in the file `release.yml`:

```yaml
asset_path: tools/installer/${{ env.INSTALLER }}
```

results, when interpreted by GitHub Actions,
in the value:

```
asset_path: tools/installer/'tlaps-1.5.0-x86_64-linux-gnu-inst.bin'
```

which raises in CI the error:

```
Error: ENOENT: no such file or directory, stat 'tools/installer/'tlaps-1.5.0-x86_64-linux-gnu-inst.bin''
```
  • Loading branch information
johnyf committed Jun 20, 2022
1 parent 7d82dc8 commit c6a5c86
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/setup_shell_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,21 @@ def _make_shell_definitions(kv: dict) -> str:
`kv=dict(NAME='value')`,
returns the string`"NAME='value'"`.
"""
any_blanks = any(map(
_contains_blanks,
kv.values()))
if any_blanks:
raise ValueError(kv)
return '\n'.join(
f"{name}='{value}'"
f'{name}={value}'
for name, value in kv.items())


def _contains_blanks(value: str) -> bool:
"""Return `True` if blankspace in `value`."""
value_ = ''.join(value.split())
return len(value) != len(value_)


if __name__ == '__main__':
_main()

0 comments on commit c6a5c86

Please sign in to comment.