diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27ae81b..7d036fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,8 @@ name: Continuous Integration on: - pull_request: - branches: [ main ] push: - branches: [ main ] + branches: [ '**' ] jobs: build_and_test: 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); +}