From 4f03314506be45b502e08753b200de4c6c3592f8 Mon Sep 17 00:00:00 2001 From: Clumsy-Coder <19594044+Clumsy-Coder@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:35:23 -0700 Subject: [PATCH] chore(ansible:tasks): add condition when setting default SHELL to zsh ## what - add condition when setting default SHELL to zsh ## how ## why - should check if the current shell is `ZSH` - should check if the env `USER` is set - when test running the workflow using `act` on a local machine, `USER` env doesn't exist ## where - ./tasks/zsh.yaml ## usage ## issue or pull request --- tasks/zsh.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tasks/zsh.yaml b/tasks/zsh.yaml index ed7da8a..c3c60c9 100644 --- a/tasks/zsh.yaml +++ b/tasks/zsh.yaml @@ -64,6 +64,9 @@ shell: cmd: chsh -s /bin/zsh {{ ansible_env.USER }} become: true + when: + - ansible_env.SHELL != '/bin/zsh' + - lookup('ansible.builtin.env', 'USER') tags: - zsh - terminal