34 lines
1.1 KiB
YAML
34 lines
1.1 KiB
YAML
---
|
|
- name: Parse Gerrit commit message and find "github" links
|
|
set_fact:
|
|
gh_prs: "{{ zuul.message|default('') | b64decode | regex_search('github: https://github.com/(.+)/pull/(.+)', '\\1', '\\2') }}"
|
|
|
|
- when:
|
|
- gh_prs | length > 1
|
|
|
|
block:
|
|
- name: Construct change if exists
|
|
set_fact:
|
|
gh_change:
|
|
project: "{{ gh_prs[0] }}"
|
|
host: "https://github.com/{{ gh_prs[0] }}/pull"
|
|
branch: "master"
|
|
refspec: "{{ gh_prs[1] }}"
|
|
|
|
- name: Make sure source dir for this change exist
|
|
file:
|
|
path: "{{ ansible_user_dir }}/src/github.com/{{ gh_prs[0] }}"
|
|
state: directory
|
|
recurse: true
|
|
|
|
- name: Fetch the required pull request
|
|
git:
|
|
repo: "https://github.com/{{ gh_prs[0] }}"
|
|
version: "pull/{{ gh_prs[1] }}/head"
|
|
refspec: "+refs/pull/{{ gh_prs[1] }}/head:refs/remotes/origin/pull/{{ gh_prs[1] }}/head"
|
|
dest: "{{ ansible_user_dir }}/src/github.com/{{ gh_prs[0] }}"
|
|
|
|
- name: Add found PRs to artg_change_list
|
|
set_fact:
|
|
artg_change_list: "{{ artg_change_list }} + [ {{ gh_change }} ]"
|