7 writes to Run
AnalyzeCiFailure (1)
CollectionProjection.cs (1)
85
Run
= new CollectedWorkflowRun
AnalyzeCiFailure.Tests (6)
AnalyzeCiFailureCSharpRerunTests.cs (1)
55
Run
= evidence.Run with { Id = parsedId, Url = $"https://github.com/microsoft/aspire/actions/runs/{parsedId}" },
AnalyzeCiFailureFixtures.cs (1)
19
Run
= new CollectedWorkflowRun
AnalyzeCiFailureMigrationTests.cs (2)
429
evidence = evidence with {
Run
= evidence.Run with { Attempt = 2 } };
589
Run
= captured.Run with { Id = 12345, Attempt = 1, Url = "https://github.com/microsoft/aspire/actions/runs/12345" },
AnalyzeCiFailureTransientContractTests.cs (1)
233
Run
= new CollectedWorkflowRun
AnalyzeCiFailureWorkflowTests.cs (1)
581
evidence = evidence with {
Run
= evidence.Run with { Scope = AnalyzeCiFailure.RunScope.Main } };
80 references to Run
AnalyzeCiFailure (61)
AnalysisCommands.cs (5)
148
progress.RunId = analysis.Bundle!.
Run
.Id;
149
progress.RunAttempt = analysis.Bundle.
Run
.Attempt;
150
progress.RunUrl = analysis.Bundle.
Run
.Url;
151
progress.HeadSha = analysis.Bundle.
Run
.HeadSha;
152
progress.RunScope = analysis.Bundle.
Run
.Scope;
AnalysisPublisher.Overflow.cs (1)
20
var runId = analysis.Bundle.
Run
.Id.ToString(CultureInfo.InvariantCulture);
AnalysisRerunner.cs (18)
60
if (request.RunId != bundle.
Run
.Id || (request.PrNumbers ?? "") != expectedPr ||
65
var id = bundle.
Run
.Id.ToString(CultureInfo.InvariantCulture);
69
Console.WriteLine($"::notice::Dry-run mode: would have rerun failed jobs for {bundle.
Run
.Url} attempt={bundle.
Run
.Attempt}.");
73
if (bundle.
Run
.Scope == RunScope.PullRequest)
77
Console.WriteLine($"::notice::No unambiguous subject PR for {bundle.
Run
.Url}; skipping rerun.");
84
Console.WriteLine($"::notice::PR #{expectedPr} is closed or locked; skipping rerun for {bundle.
Run
.Url}.");
90
Console.WriteLine($"::warning::Cannot check PR #{expectedPr}; skipping rerun for {bundle.
Run
.Url}: " +
102
throw new ValidationException($"Unable to read current run {bundle.
Run
.Url} attempt={bundle.
Run
.Attempt}: " +
105
if (current is not JsonObject run || !GitHubJson.TryReadId(run["id"], out var currentId) || currentId != bundle.
Run
.Id ||
108
throw new ValidationException($"Invalid current workflow run metadata for {bundle.
Run
.Url}.");
110
if (currentAttempt != bundle.
Run
.Attempt)
112
Console.WriteLine($"::warning::Run attempt advanced for {bundle.
Run
.Url}; skipping stale rerun request.");
126
throw new ValidationException($"Unable to request rerun for {bundle.
Run
.Url} attempt={bundle.
Run
.Attempt}: " +
129
Console.WriteLine($"::notice::Requested rerun of failed jobs for {bundle.
Run
.Url} attempt={bundle.
Run
.Attempt}.");
AnalysisValidator.cs (23)
23
proposal.Run.Id != evidence.
Run
.Id || proposal.Run.Attempt != evidence.
Run
.Attempt)
113
var run = new ValidatedRun(evidence.
Run
.Scope, evidence.
Run
.Url, evidence.SubjectPr is { } pr ? Decimal(pr.Number) : "");
168
RunId = JsonNumber(evidence.
Run
.Id),
169
RunAttempt = JsonSerializer.SerializeToElement(evidence.
Run
.Attempt),
170
RunScope = evidence.
Run
.Scope,
171
HeadSha = JsonSerializer.SerializeToElement(evidence.
Run
.HeadSha),
172
Event = evidence.
Run
.Event,
173
HeadBranch = evidence.
Run
.HeadBranch,
176
new WorkflowRun { HtmlUrl = evidence.
Run
.Url, HeadSha = JsonSerializer.SerializeToElement(evidence.
Run
.HeadSha) },
261
evidence.SchemaVersion != 1 || evidence.
Run
is null || evidence.
Run
.Repository != expectedRepository ||
262
evidence.
Run
.Id <= 0 || evidence.
Run
.Attempt <= 0 || !Enum.IsDefined(evidence.
Run
.Scope) ||
263
evidence.
Run
.Url != $"https://github.com/{expectedRepository}/actions/runs/{Decimal(evidence.
Run
.Id)}")
267
var main = evidence.
Run
.Scope == RunScope.Main;
268
if (main != (evidence.
Run
.Event == "push" && evidence.
Run
.HeadBranch == "main") ||
269
!main && evidence.
Run
.Event is not ("pull_request" or "pull_request_target") ||
EvidencePreparation.cs (11)
126
["run_id"] = input.Evidence.
Run
.Id.ToString(CultureInfo.InvariantCulture),
127
["run_attempt"] = input.Evidence.
Run
.Attempt,
170
progress.RunId = bundle.
Run
.Id; progress.RunAttempt = bundle.
Run
.Attempt; progress.HasRelevantFailures = true;
171
progress.HeadSha = bundle.
Run
.HeadSha; progress.RunUrl = bundle.
Run
.Url; progress.RunScope = bundle.
Run
.Scope;
173
AnalysisValidator.ValidateBundle(bundle, bundle.
Run
.Repository);
298
var runId = bundle.
Run
.Id.ToString(CultureInfo.InvariantCulture);
299
var attempt = bundle.
Run
.Attempt.ToString(CultureInfo.InvariantCulture);
300
var source = $"https://github.com/{bundle.
Run
.Repository}/actions/runs/{runId}/attempts/{attempt}";
WorkflowFailureDiagnosisContextBuilder.cs (3)
21
AppendJson(summary, TransientJson.ToElement(bundle.
Run
));
90
summary.Append(bundle.
Run
.Scope == RunScope.Main ? "\n## Main Branch Context\n\n" : "\n## Pull Request\n\n");
91
AppendJson(summary, bundle.
Run
.Scope == RunScope.Main ? TransientJson.ToElement(bundle.MainContext) : TransientJson.ToElement(bundle.SubjectPr));
AnalyzeCiFailure.Tests (19)
AnalyzeCiFailureAlternateWorkflowTests.cs (1)
308
Assert.Equal(RunScope.Main, result.Run!.Evidence.
Run
.Scope);
AnalyzeCiFailureCohesionTests.cs (4)
57
Assert.Equal(bundle.
Run
.Id, outcome.RunId);
58
Assert.Equal(bundle.
Run
.Attempt, outcome.RunAttempt);
59
Assert.Equal(bundle.
Run
.HeadSha, outcome.HeadSha);
60
Assert.Equal(bundle.
Run
.Url, outcome.RunUrl);
AnalyzeCiFailureCSharpRerunTests.cs (2)
55
Run = evidence.
Run
with { Id = parsedId, Url = $"https://github.com/microsoft/aspire/actions/runs/{parsedId}" },
186
Assert.Contains(evidence.
Run
.Url, result.Output, StringComparison.Ordinal);
AnalyzeCiFailureFixtures.cs (3)
39
SchemaVersion = 1, Run = new ProposedWorkflowRun { Repository = evidence.
Run
.Repository, Id = evidence.
Run
.Id, Attempt = evidence.
Run
.Attempt },
AnalyzeCiFailureMigrationTests.cs (7)
429
evidence = evidence with { Run = evidence.
Run
with { Attempt = 2 } };
519
Run = new ProposedWorkflowRun { Repository = evidence.
Run
.Repository, Id = evidence.
Run
.Id, Attempt = evidence.
Run
.Attempt },
589
Run = captured.
Run
with { Id = 12345, Attempt = 1, Url = "https://github.com/microsoft/aspire/actions/runs/12345" },
691
Assert.Equal(123, bundle.
Run
.Id);
692
Assert.Equal(2, bundle.
Run
.Attempt);
AnalyzeCiFailureRuleTests.cs (1)
52
case "url": facts["run"]!["url"] = evidence.
Run
.Url + "/jobs/1"; break;
AnalyzeCiFailureWorkflowTests.cs (1)
581
evidence = evidence with { Run = evidence.
Run
with { Scope = AnalyzeCiFailure.RunScope.Main } };