Skip to content

Commit 334ffd6

Browse files
Merge pull request #43 from MonolithProjects/develop
Allow to create runners for repos which are not owned by the user, but to which the user has access
2 parents f664f82 + 99f39e9 commit 334ffd6

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- develop
77
- feature/*
8+
pull_request:
9+
branches:
10+
- develop
11+
types: [opened, synchronize, reopened]
812
jobs:
913
lint:
1014
runs-on: ubuntu-18.04

.github/workflows/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches:
66
- master
77
pull_request:
8+
branches:
9+
- master
810
types: [opened, synchronize, reopened]
911
schedule:
1012
- cron: '0 6 * * 0'

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ It supports both, Organization and Repository Runners.
1414
* System must have access to the GitHub.
1515

1616
* The role require Personal Access Token to access the GitHub. The token has to be a value of `PERSONAL_ACCESS_TOKEN` variable.
17-
Export the token to the local host environment. The token has to have admin rights for the repo.
17+
Export the token to the local host environment.
18+
> The token must have the `repo` scope (when creating a repo runner) or the `admin:org` scope (when creating a runner for an organization).
1819
Personal Access Token for GitHub account can be created [here](https://github.com/settings/tokens).
19-
**Note:** Never store you personal access token in the GitHub repository. Use [GitHub Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) or some different secrets service.
20+
21+
> :warning: **Never** store you personal access token in the GitHub repository. Use [GitHub Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) or some different secrets service.
2022
2123
* Runner user has to be pre-created.
2224
Recommended role: `monolithprojects.user_management`

tasks/collect_info_org.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/orgs/{{ github_account }}/actions/runners/registration-token"
4+
url: "https://api.github.com/orgs/{{ github_owner | default(github_account) }}/actions/runners/registration-token"
55
headers:
66
Authorization: "token {{ access_token }}"
77
Accept: "application/vnd.github.v3+json"
@@ -16,7 +16,7 @@
1616

1717
- name: Check currently registered runners (RUN ONCE)
1818
uri:
19-
url: "https://api.github.com/orgs/{{ github_account }}/actions/runners"
19+
url: "https://api.github.com/orgs/{{ github_owner | default(github_account) }}/actions/runners"
2020
headers:
2121
Authorization: "token {{ access_token }}"
2222
Accept: "application/vnd.github.v3+json"
@@ -40,4 +40,4 @@
4040
runner_service: "actions.runner.{{ github_account[:45] }}.{{ runner_name }}.service"
4141
tags:
4242
- install
43-
- uninstall
43+
- uninstall

tasks/collect_info_repo.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
headers:
66
Authorization: "token {{ access_token }}"
77
Accept: "application/vnd.github.v3+json"
@@ -16,7 +16,7 @@
1616

1717
- name: Check currently registered runners (RUN ONCE)
1818
uri:
19-
url: "https://api.github.com/repos/{{ github_account }}/{{ github_repo }}/actions/runners"
19+
url: "https://api.github.com/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners"
2020
headers:
2121
Authorization: "token {{ access_token }}"
2222
Accept: "application/vnd.github.v3+json"
@@ -47,4 +47,4 @@
4747
runner_service: "actions.runner.{{ svc_name[:45] }}.{{ runner_name }}.service"
4848
tags:
4949
- install
50-
- uninstall
50+
- uninstall

0 commit comments

Comments
 (0)