Skip to content

Commit

Permalink
Add missed main func for GitHub Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Bardin08 committed May 9, 2024
1 parent 3ad7caa commit 8774170
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions GitHubUtils/Program.cs
Original file line number Diff line number Diff line change
@@ -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]);

Check warning on line 16 in GitHubUtils/Program.cs

View workflow job for this annotation

GitHub Actions / build_and_test

Dereference of a possibly null reference.

Check warning on line 16 in GitHubUtils/Program.cs

View workflow job for this annotation

GitHub Actions / build_and_test

Dereference of a possibly null reference.
var response = await githubClient.GrantAccessToRepository(request);
Console.WriteLine("Access granted to: " + response.First().RepositoryName);
}

0 comments on commit 8774170

Please sign in to comment.