Skip to content

Commit

Permalink
Fix env var
Browse files Browse the repository at this point in the history
  • Loading branch information
mmena1 committed Mar 14, 2024
1 parent ef4a30f commit 0b6f081
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Chezmoi Setup Validation

on:
push:
branches:
- '*'
on: push
env:
dev: false

jobs:
validate-chezmoi-setup:
runs-on: ubuntu-latest
environment: CI
steps:
- name: Extract branch name
shell: bash
Expand Down
4 changes: 2 additions & 2 deletions home/.chezmoi.toml.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{- $email := "example@email.com" -}}
{{- if eq (env "ENVIRONMENT") "dev" -}}
{{- if env "dev" -}}
{{- $email = promptStringOnce . "email" "Email address" -}}
{{- end -}}
{{- $osid := .chezmoi.os -}}
Expand All @@ -11,4 +11,4 @@
[data]
email = {{ $email | quote }}
osid = {{ $osid | quote }}
environment = {{ env "ENVIRONMENT" | default "dev" | quote }}
dev = {{ env "dev" | default true }}
2 changes: 1 addition & 1 deletion home/.chezmoiscripts/run_before_00-intro.sh.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if eq .environment "dev" -}}
{{ if .dev -}}
{{ template "common" . -}}
{{ template "dotfile" }}

Expand Down
2 changes: 1 addition & 1 deletion home/.chezmoiscripts/run_once_after_04-ssh-keys.sh.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if eq .environment "dev" -}}
{{ if .dev -}}
{{ template "common" . -}}

set_ssh_keys() {
Expand Down
6 changes: 3 additions & 3 deletions home/.chezmoitemplates/common
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ function error() {
echo -e "$COL_RED[error]$COL_RESET "$1
}

function prompt() {
{{ if eq .environment "dev" -}}
read -rp $1" [y/N]" -n 1 -r -s answer
function prompt {
{{ if .dev -}}
read -rp "$1 [y/N]" -n 1 -r -s answer
{{ else -}}
answer="y"
{{ end -}}
Expand Down

0 comments on commit 0b6f081

Please sign in to comment.