Skip to content

Commit

Permalink
fix repo and org naming issues
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticroentgen committed May 6, 2024
1 parent b704e1e commit 23fe6ce
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,16 @@ public static void Main(string[] args)
}
long jobId = workflowJson.GetProperty("id").GetInt64();
string repoName = json.RootElement.GetProperty("repository").GetProperty("full_name").GetString();
string orgName = json.RootElement.GetProperty("organization").GetProperty("login").GetString();
string repoNameRequest = json.RootElement.GetProperty("repository").GetProperty("full_name").GetString();
string orgNameRequest = json.RootElement.GetProperty("organization").GetProperty("login").GetString();
// Needed to get properly cased names
string orgName = Config.TargetConfigs.FirstOrDefault(x =>
x.Target == TargetType.Organization && x.Name.ToLower() == orgNameRequest.ToLower()).Name;
string repoName = Config.TargetConfigs.FirstOrDefault(x =>
x.Target == TargetType.Repository && x.Name.ToLower() == repoNameRequest.ToLower())?.Name ?? repoNameRequest;
// Check if its an org or a repo
if (String.IsNullOrEmpty(orgName))
{
Expand All @@ -157,8 +164,8 @@ public static void Main(string[] args)
}
// Check if Org is configured
bool isOrg = Config.TargetConfigs.Any(x => x.Name.ToLower() == orgName.ToLower() && x.Target == TargetType.Organization);
bool isRepo = Config.TargetConfigs.Any(x => x.Name.ToLower() == repoName.ToLower() && x.Target == TargetType.Repository);
bool isOrg = Config.TargetConfigs.Any(x => x.Name == orgName && x.Target == TargetType.Organization);
bool isRepo = Config.TargetConfigs.Any(x => x.Name == repoName && x.Target == TargetType.Repository);
if (!isOrg && !isRepo)
{
Expand Down

0 comments on commit 23fe6ce

Please sign in to comment.