From fb289424e8fb5907421407a73cf9c1683c97e017 Mon Sep 17 00:00:00 2001 From: Kuba Mazurek Date: Fri, 27 Nov 2020 14:28:49 +0100 Subject: [PATCH 1/3] Use github_owner in collect_info_* tasks --- tasks/collect_info_org.yml | 6 +++--- tasks/collect_info_repo.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/collect_info_org.yml b/tasks/collect_info_org.yml index e882d38..5d1797d 100644 --- a/tasks/collect_info_org.yml +++ b/tasks/collect_info_org.yml @@ -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" @@ -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" @@ -40,4 +40,4 @@ runner_service: "actions.runner.{{ github_account[:45] }}.{{ runner_name }}.service" tags: - install - - uninstall \ No newline at end of file + - uninstall diff --git a/tasks/collect_info_repo.yml b/tasks/collect_info_repo.yml index 78dd798..97841bf 100644 --- a/tasks/collect_info_repo.yml +++ b/tasks/collect_info_repo.yml @@ -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" @@ -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" @@ -47,4 +47,4 @@ runner_service: "actions.runner.{{ svc_name[:45] }}.{{ runner_name }}.service" tags: - install - - uninstall \ No newline at end of file + - uninstall From e7bee6396bca5417f2bd922ee92a00cfdaf763a8 Mon Sep 17 00:00:00 2001 From: Kuba Mazurek Date: Fri, 27 Nov 2020 15:19:31 +0100 Subject: [PATCH 2/3] Update GitHub token readme section --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 313f073..c28aeb0 100644 --- a/README.md +++ b/README.md @@ -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` From 99f39e9569815ef7be4e47a8f91bee4471a6945a Mon Sep 17 00:00:00 2001 From: Michal Muransky Date: Fri, 27 Nov 2020 20:08:32 +0100 Subject: [PATCH 3/3] Fix github workflows --- .github/workflows/lint.yml | 4 ++++ .github/workflows/main.yml | 2 ++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7747a80..9f21eff 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,6 +5,10 @@ on: branches: - develop - feature/* + pull_request: + branches: + - develop + types: [opened, synchronize, reopened] jobs: lint: runs-on: ubuntu-18.04 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c2a120e..ec52c92 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,8 @@ on: branches: - master pull_request: + branches: + - master types: [opened, synchronize, reopened] schedule: - cron: '0 6 * * 0'