Skip to content

Commit

Permalink
fix: match with regex also for require_env section with more rich sam…
Browse files Browse the repository at this point in the history
…ple in README
  • Loading branch information
RaVbaker committed Jan 25, 2021
1 parent aa70644 commit 5ebe257
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ hooks:
spec:
command: echo "foo {path} OK"
- type: http
match_context:
branch: main
origin: /^travis Build/
spec:
method: POST
url: https://httpbin.org/post
Expand All @@ -75,9 +78,11 @@ hooks:
content-type: application/json
- type: aws_lambda
require_env:
- USER=ravbaker
- TERM=xterm-256color
- /USER=(ravbaker|root)/
spec:
function_name: "${USER}-lambda-run"
assume_role: "arn:aws:iam::123456789012:role/LambdaRunner"
function_name: "my-${USER}-lambda"
region: "us-east-1"
payload: "{}"
```
Expand Down
2 changes: 1 addition & 1 deletion internal/hooks/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (h *Hook) CanRun(path string, ctx speccontext.GitContext, partsCtx parts.Co

func envInclude(definition string) (matched bool) {
for _, envLine := range os.Environ() {
matched = matched || envLine == definition
matched = matched || compareMatch(definition, envLine)
}
return
}
Expand Down

0 comments on commit 5ebe257

Please sign in to comment.