Skip to content

Commit

Permalink
fix: allow to provide $ sign in ENV expanded hook definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
RaVbaker committed May 27, 2021
1 parent 3bbfa1e commit 344be5f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ hooks:
assume_role: "arn:aws:iam::123456789012:role/LambdaRunner"
function_name: "my-${USER}-lambda"
region: "us-east-1"
payload: "{}"
payload: "{\"some\": \"$$ will be dollar sign while $@ or ${PATH} will get replaced from the runtime\"}"
```
## Makefile
Expand Down
4 changes: 3 additions & 1 deletion internal/hooks/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,7 @@ func (h *Hook) Definition() Spec {

func templateString(path, template string) string {
template = strings.ReplaceAll(template, "{path}", path)
return os.ExpandEnv(template)
template = strings.ReplaceAll(template, "$$", "$&&")
template = os.ExpandEnv(template)
return strings.ReplaceAll(template, "$&&", "$")
}

0 comments on commit 344be5f

Please sign in to comment.