Skip to content

Commit 6531006

Browse files
authored
Merge pull request #372 from stackhpc/fix-master-prefix
Add prefix to automated branch names
2 parents da50003 + ccbdd87 commit 6531006

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ansible/roles/source-repo-sync/tasks/add_community_files.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
cmd: |
1818
gh api \
1919
-H "Accept: application/vnd.github.v3+json" \
20-
/repos/{{ owner }}/{{ repository_manifest.name }}/git/ref/heads/{{ community_manifest.branch }}-community-files
20+
/repos/{{ owner }}/{{ repository_manifest.name }}/git/ref/heads/{{ community_manifest.prefix | default("") }}{{ community_manifest.branch }}-community-files
2121
changed_when: false
2222
failed_when: false
2323
register: branch_exists
@@ -28,13 +28,13 @@
2828
gh api \
2929
--method DELETE \
3030
-H "Accept: application/vnd.github.v3+json" \
31-
/repos/{{ owner }}/{{ repository_manifest.name }}/git/refs/heads/{{ community_manifest.branch }}-community-files
31+
/repos/{{ owner }}/{{ repository_manifest.name }}/git/refs/heads/{{ community_manifest.prefix | default("") }}{{ community_manifest.branch }}-community-files
3232
when: branch_exists.rc == 0
3333

3434
- name: Create working branch # noqa command-instead-of-module
3535
ansible.builtin.shell:
3636
cmd: >
37-
git checkout -b {{ community_manifest.branch }}-community-files \
37+
git checkout -b {{ community_manifest.prefix | default("") }}{{ community_manifest.branch }}-community-files \
3838
origin/{{ community_manifest.prefix | default("") }}{{ community_manifest.branch }}
3939
chdir: "{{ staging_path }}/{{ repository_manifest.name }}"
4040
changed_when: true
@@ -65,7 +65,7 @@
6565

6666
- name: Push branch to remote # noqa command-instead-of-module command-instead-of-shell no-handler
6767
ansible.builtin.shell:
68-
cmd: "git push -u origin {{ community_manifest.branch }}-community-files"
68+
cmd: "git push -u origin {{ community_manifest.prefix | default('') }}{{ community_manifest.branch }}-community-files"
6969
chdir: "{{ staging_path }}/{{ repository_manifest.name }}"
7070
when: community_copy.changed | bool
7171

ansible/roles/source-repo-sync/tasks/add_workflows.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
cmd: |
1818
gh api \
1919
-H "Accept: application/vnd.github.v3+json" \
20-
/repos/{{ owner }}/{{ repository_manifest.name }}/git/ref/heads/{{ workflow_manifest.branch }}-workflows
20+
/repos/{{ owner }}/{{ repository_manifest.name }}/git/ref/heads/{{ workflow_manifest.prefix | default("") }}{{ workflow_manifest.branch }}-workflows
2121
changed_when: false
2222
failed_when: false
2323
register: working_branch_exists
@@ -28,13 +28,13 @@
2828
gh api \
2929
--method DELETE \
3030
-H "Accept: application/vnd.github.v3+json" \
31-
/repos/{{ owner }}/{{ repository_manifest.name }}/git/refs/heads/{{ workflow_manifest.branch }}-workflows
31+
/repos/{{ owner }}/{{ repository_manifest.name }}/git/refs/heads/{{ workflow_manifest.prefix | default("") }}{{ workflow_manifest.branch }}-workflows
3232
when: working_branch_exists.rc == 0
3333

3434
- name: Create working branch # noqa command-instead-of-module
3535
ansible.builtin.shell:
3636
cmd: >
37-
git checkout -b {{ workflow_manifest.branch }}-workflows \
37+
git checkout -b {{ workflow_manifest.prefix | default("") }}{{ workflow_manifest.branch }}-workflows \
3838
origin/{{ workflow_manifest.prefix | default("") }}{{ workflow_manifest.branch }}
3939
chdir: "{{ staging_path }}/{{ repository_manifest.name }}"
4040
changed_when: true
@@ -84,7 +84,7 @@
8484

8585
- name: Push branch to remote # noqa command-instead-of-module command-instead-of-shell no-handler
8686
ansible.builtin.shell:
87-
cmd: "git push -u origin {{ workflow_manifest.branch }}-workflows"
87+
cmd: "git push -u origin {{ workflow_manifest.prefix | default('') }}{{ workflow_manifest.branch }}-workflows"
8888
chdir: "{{ staging_path }}/{{ repository_manifest.name }}"
8989
changed_when: true
9090

0 commit comments

Comments
 (0)