Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

demo: single fail dev #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/called.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"with":
"fetch-depth": 0
- "name": "check for ${{ inputs.environment }}"
"run": "cat stacks/${{ inputs.environment }}/*"
"run": "[ ${{ inputs.environment }} != \"dev\" ]"
"on":
"workflow_call":
"inputs":
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
- "id": "generate"
"name": "generate matrix"
"run": |
output="$(for i in dev staging prod ; do [[ -z $(git diff --name-only origin/main...HEAD | grep -E "stacks/${i}") ]] || echo $i ; done)"
output="$(for i in dev staging prod ; do [[ -z $(git diff --name-only origin/master...HEAD | grep -E "stacks/${i}") ]] || echo $i ; done)"
[ -z "$output" ] || echo "matrix=[\""${output//[ ]/\", \"}"\"]" >> "$GITHUB_OUTPUT"
"name": "main"
"on":
Expand Down
2 changes: 2 additions & 0 deletions globals.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ globals "workflows" {
}

globals "repository" {
# my account is so old that the default branch was `master`
main = "master"
# which environments to manage
environments = ["dev", "staging", "prod"]
# run workflows on all environments regardless of change
Expand Down
2 changes: 1 addition & 1 deletion imports/called.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ globals "workflow" "called" {
},
{
name = "check for $${{ inputs.environment }}"
run = "cat stacks/$${{ inputs.environment }}/*"
run = "[ $${{ inputs.environment }} != \"dev\" ]"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion imports/main.tm.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ globals "workflow" "main" {
name = "generate matrix"
id = "generate"
run = <<-EOF
output="$(for i in ${tm_join(" ", global.repository.environments)} ; do [[ -z $(git diff --name-only origin/main...HEAD | grep -E "stacks/$${i}") ]] || echo $i ; done)"
output="$(for i in ${tm_join(" ", global.repository.environments)} ; do [[ -z $(git diff --name-only origin/${global.repository.main}...HEAD | grep -E "stacks/$${i}") ]] || echo $i ; done)"
[ -z "$output" ] || echo "matrix=[\""$${output//[ ]/\", \"}"\"]" >> "$GITHUB_OUTPUT"
EOF
}
Expand Down
1 change: 1 addition & 0 deletions stacks/dev/file
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
this is dev!
and it is doomed!
Loading