Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CI trigger branches #2

Merged
merged 3 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Continuous Integration

on:
pull_request:
branches: [ main ]
push:
branches: [ main ]
branches: [ '**' ]

jobs:
build_and_test:
Expand Down
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);
}
Loading