From 18d93734209d67c657929c321d3f3381b721fce3 Mon Sep 17 00:00:00 2001 From: Bardin08 Date: Thu, 9 May 2024 17:08:18 +0300 Subject: [PATCH 1/3] Update CI trigger branches --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27ae81b..4440323 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: Continuous Integration on: pull_request: - branches: [ main ] + branches: [ '**' ] push: - branches: [ main ] + branches: [ '**' ] jobs: build_and_test: From 3ad7caad09c5cbe10a6942fdd5f117185458c009 Mon Sep 17 00:00:00 2001 From: Bardin08 Date: Thu, 9 May 2024 17:09:51 +0300 Subject: [PATCH 2/3] Update CI trigger to push --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4440323..7d036fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,8 +1,6 @@ name: Continuous Integration on: - pull_request: - branches: [ '**' ] push: branches: [ '**' ] From 8774170e41ac9bbdda0732ab2b49e90dafb6c8dd Mon Sep 17 00:00:00 2001 From: Bardin08 Date: Thu, 9 May 2024 17:11:35 +0300 Subject: [PATCH 3/3] Add missed main func for GitHub Utils --- GitHubUtils/Program.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 GitHubUtils/Program.cs diff --git a/GitHubUtils/Program.cs b/GitHubUtils/Program.cs new file mode 100644 index 0000000..eb63bd9 --- /dev/null +++ b/GitHubUtils/Program.cs @@ -0,0 +1,19 @@ +using GitHubUtils.Core; + +const string githubToken = "pat_token"; +const string organizationName = "org_name"; +const string teamName = "team_name"; +const string repositoryPrefix = "repo_prefix"; + +var githubClient = new GitHubClientWrapper(githubToken); + +var team = await githubClient.GetTeam(organizationName, teamName); +var filteredRepos = await githubClient.GetRepos(organizationName, + r => r.Name.StartsWith(repositoryPrefix, StringComparison.OrdinalIgnoreCase)); + +foreach (var repo in filteredRepos) +{ + var request = new RepoAssignRequest(repo.Name, organizationName, [team.Id]); + var response = await githubClient.GrantAccessToRepository(request); + Console.WriteLine("Access granted to: " + response.First().RepositoryName); +}