From d5a5759d5a0c3ea6f3e713f458bf60bf14638eb2 Mon Sep 17 00:00:00 2001 From: Nick Larsen Date: Tue, 29 Oct 2024 15:13:50 +0100 Subject: [PATCH] fix(playbook): git config for dry-run Instead of using git config --global, make the git config commands local to each operator repository. This is then safe to run via test.sh (dry-run). --- playbook/playbook.yaml | 8 -------- playbook/update_repo.yaml | 10 ++++++++++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/playbook/playbook.yaml b/playbook/playbook.yaml index 1203a294..49449f63 100644 --- a/playbook/playbook.yaml +++ b/playbook/playbook.yaml @@ -15,14 +15,6 @@ path: "{{ work_dir }}" state: directory - - name: Configure git author mail - command: - argv: [git, config, --global, user.email, "{{ author_mail }}"] - - - name: Configure git author name - command: - argv: [git, config, --global, user.name, "{{ author_name }}"] - - name: Login to github command: argv: [gh, auth, login, --with-token] diff --git a/playbook/update_repo.yaml b/playbook/update_repo.yaml index 9fc7085f..a8268c4d 100644 --- a/playbook/update_repo.yaml +++ b/playbook/update_repo.yaml @@ -111,6 +111,16 @@ register: git_change failed_when: git_change.rc == 0 # fail when there are no changes + - name: Configure git author mail + command: + argv: [git, config, user.email, "{{ author_mail }}"] + chdir: "{{ work_dir }}/{{ operator.name }}" + + - name: Configure git author name + command: + argv: [git, config, user.name, "{{ author_name }}"] + chdir: "{{ work_dir }}/{{ operator.name }}" + - name: "Operator [{{ operator.name }}] stage all changes" command: argv: [git, add, .]