From af9c944f5e824815cddf007fbcd25f01c6cc6317 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Thu, 14 Oct 2021 14:16:12 +0200 Subject: [PATCH] roles/pulpito: support github pull branches to checkout Signed-off-by: Kyr Shatskyy --- roles/pulpito/tasks/setup_pulpito.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/roles/pulpito/tasks/setup_pulpito.yml b/roles/pulpito/tasks/setup_pulpito.yml index 84b740f..f9ea51b 100644 --- a/roles/pulpito/tasks/setup_pulpito.yml +++ b/roles/pulpito/tasks/setup_pulpito.yml @@ -1,4 +1,19 @@ --- +- name: Determine GitHub Pull Request + set_fact: + pulpito_pull: "{{ pulpito_branch | regex_replace( '^refs/pull/([^/]+)/.*$', '\\1') }}" + +- name: Clone the repo and checkout pull request branch + git: + repo: "{{ pulpito_repo }}" + dest: "{{ pulpito_repo_path }}" + version: "pull-{{ pulpito_pull }}" + refspec: '+{{ pulpito_branch }}:refs/remotes/origin/pull-{{ pulpito_pull }}' + become_user: "{{ pulpito_user }}" + tags: + - repos + when: pulpito_pull is defined and pulpito_pull != pulpito_branch + - name: Checkout the repo git: repo: "{{ pulpito_repo }}" @@ -7,6 +22,7 @@ become_user: "{{ pulpito_user }}" tags: - repos + when: pulpito_pull is not defined or pulpito_pull == pulpito_branch - name: Look for the virtualenv stat: -- 2.39.5