Skip to content

Commit 4595364

Browse files
Support organization owner in Github api url
1 parent 82078d0 commit 4595364

File tree

5 files changed

+26
-17
lines changed

5 files changed

+26
-17
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- master
77
- develop
8+
- feature/*
89
schedule:
910
- cron: '0 6 * * 0'
1011
jobs:

README.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,18 @@ replace_runner: yes
5151
# Do not show Ansible logs which may contain sensitive data (registration token)
5252
hide_sensitive_logs: yes
5353

54-
# Personal Access Token for your GitHub account
55-
access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
56-
5754
# GitHub address
5855
github_server: "https://github.com"
5956

60-
# GitHub account name
57+
# Personal Access Token for your GitHub account
58+
access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
59+
60+
# GitHub access account
6161
# github_account: "youruser"
6262

63+
# GitHub Organization owner or Repository admin used for Runner registration (can be omitted if it is the same as "github_acount")
64+
# github_owner: "owneruser"
65+
6366
# Github repository name
6467
# github_repo: "yourrepo"
6568
```
@@ -104,12 +107,14 @@ By using tag `uninstall`, GitHub Actions runner will be removed from the host an
104107
ansible-playbook playbook.yml --tags uninstall
105108
```
106109

107-
License
108-
-------
110+
## Colaboraton
111+
112+
TODO
113+
114+
## License
109115

110116
MIT
111117

112-
Author Information
113-
------------------
118+
## Author Information
114119

115120
Created in 2020 by Michal Muransky

defaults/main.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ replace_runner: yes
1414
# Do not show Ansible logs which may contain sensitive data (registration token)
1515
hide_sensitive_logs: yes
1616

17-
# Personal Access Token for your GitHub account
18-
access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
19-
2017
# GitHub address
2118
github_server: "https://github.com"
2219

23-
# GitHub account name
20+
# Personal Access Token for your GitHub account
21+
access_token: "{{ lookup('env', 'PERSONAL_ACCESS_TOKEN') }}"
22+
23+
# GitHub access account
2424
# github_account: "youruser"
2525

26+
# GitHub Organization owner or Repository admin used for Runner registration (can be omited if it is the same as "github_acount")
27+
# github_account: "owneruser"
28+
2629
# Github repository name
2730
# github_repo: "yourrepo"

tasks/collect_info.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
- name: Get registration token (RUN ONCE)
33
uri:
4-
url: "https://api.github.com/repos/{{ github_account }}/{{ github_repo }}/actions/runners/registration-token"
4+
url: "https://api.github.com/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners/registration-token"
55
user: "{{ github_account }}"
66
password: "{{ access_token }}"
77
method: POST
@@ -15,7 +15,7 @@
1515

1616
- name: Check currently registered runners (RUN ONCE)
1717
uri:
18-
url: "https://api.github.com/repos/{{ github_account }}/{{ github_repo }}/actions/runners"
18+
url: "https://api.github.com/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners"
1919
user: "{{ github_account }}"
2020
password: "{{ access_token }}"
2121
method: GET
@@ -35,7 +35,7 @@
3535

3636
- name: Combine Github account and repo names
3737
set_fact:
38-
svc_name: "{{ github_account }}-{{ github_repo }}"
38+
svc_name: "{{ github_owner | default(github_account) }}-{{ github_repo }}"
3939
tags:
4040
- install
4141
- uninstall

tasks/install_runner.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
- install
5252

5353
- name: Register runner (if new installation)
54-
command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} \
54+
command: "{{ runner_dir }}/./config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }}/{{ github_repo }} \
5555
--token {{ registration.json.token }} --unattended"
5656
args:
5757
chdir: "{{ runner_dir }}"
@@ -63,7 +63,7 @@
6363
- install
6464

6565
- name: Replace registered runner
66-
command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_account }}/{{ github_repo }} \
66+
command: "{{ runner_dir }}/config.sh --url {{ github_server }}/{{ github_owner | default(github_account) }}/{{ github_repo }} \
6767
--token {{ registration.json.token }} --unattended --replace"
6868
args:
6969
chdir: "{{ runner_dir }}"

0 commit comments

Comments
 (0)