Skip to content

Commit

Permalink
Merge pull request #43 from MonolithProjects/develop
Browse files Browse the repository at this point in the history
Allow to create runners for repos which are not owned by the user, but to which the user has access
  • Loading branch information
MonolithProjects authored Nov 27, 2020
2 parents f664f82 + 99f39e9 commit 334ffd6
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- develop
- feature/*
pull_request:
branches:
- develop
types: [opened, synchronize, reopened]
jobs:
lint:
runs-on: ubuntu-18.04
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches:
- master
pull_request:
branches:
- master
types: [opened, synchronize, reopened]
schedule:
- cron: '0 6 * * 0'
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ It supports both, Organization and Repository Runners.
* System must have access to the GitHub.

* The role require Personal Access Token to access the GitHub. The token has to be a value of `PERSONAL_ACCESS_TOKEN` variable.
Export the token to the local host environment. The token has to have admin rights for the repo.
Export the token to the local host environment.
> The token must have the `repo` scope (when creating a repo runner) or the `admin:org` scope (when creating a runner for an organization).
Personal Access Token for GitHub account can be created [here](https://github.com/settings/tokens).
**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.

> :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.
* Runner user has to be pre-created.
Recommended role: `monolithprojects.user_management`
Expand Down
6 changes: 3 additions & 3 deletions tasks/collect_info_org.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Get registration token (RUN ONCE)
uri:
url: "https://api.github.com/orgs/{{ github_account }}/actions/runners/registration-token"
url: "https://api.github.com/orgs/{{ github_owner | default(github_account) }}/actions/runners/registration-token"
headers:
Authorization: "token {{ access_token }}"
Accept: "application/vnd.github.v3+json"
Expand All @@ -16,7 +16,7 @@

- name: Check currently registered runners (RUN ONCE)
uri:
url: "https://api.github.com/orgs/{{ github_account }}/actions/runners"
url: "https://api.github.com/orgs/{{ github_owner | default(github_account) }}/actions/runners"
headers:
Authorization: "token {{ access_token }}"
Accept: "application/vnd.github.v3+json"
Expand All @@ -40,4 +40,4 @@
runner_service: "actions.runner.{{ github_account[:45] }}.{{ runner_name }}.service"
tags:
- install
- uninstall
- uninstall
6 changes: 3 additions & 3 deletions tasks/collect_info_repo.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Get registration token (RUN ONCE)
uri:
url: "https://api.github.com/repos/{{ github_account }}/{{ github_repo }}/actions/runners/registration-token"
url: "https://api.github.com/repos/{{ github_owner | default(github_account) }}/{{ github_repo }}/actions/runners/registration-token"
headers:
Authorization: "token {{ access_token }}"
Accept: "application/vnd.github.v3+json"
Expand All @@ -16,7 +16,7 @@

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

0 comments on commit 334ffd6

Please sign in to comment.