Skip to content

Commit

Permalink
Merge branch 'main' into sm
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX authored Nov 13, 2024
2 parents 3def459 + e0eadd1 commit ae3693b
Show file tree
Hide file tree
Showing 90 changed files with 3,001 additions and 251 deletions.
3 changes: 2 additions & 1 deletion src/Runner.Language.Server/AutoCompleter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ public async Task<CompletionList> Handle(CompletionParams request, CancellationT
TraceWriter = new GitHub.DistributedTask.ObjectTemplating.EmptyTraceWriter(),
Flags = GitHub.DistributedTask.Expressions2.ExpressionFlags.DTExpressionsV1 | GitHub.DistributedTask.Expressions2.ExpressionFlags.ExtendedDirectives | GitHub.DistributedTask.Expressions2.ExpressionFlags.AllowAnyForInsert,
Column = column,
Row = row
Row = row,
RawMapping = true
};
GitHub.DistributedTask.ObjectTemplating.Schema.TemplateSchema? schema = null;
try {
Expand Down
291 changes: 287 additions & 4 deletions src/Runner.Language.Server/CodeLensProvider.cs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Runner.Language.Server/HoverProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ private static TemplateContext CreateTemplateContext(GitHub.DistributedTask.Obje
TraceWriter = new GitHub.DistributedTask.ObjectTemplating.EmptyTraceWriter(),
Flags = GitHub.DistributedTask.Expressions2.ExpressionFlags.DTExpressionsV1 | GitHub.DistributedTask.Expressions2.ExpressionFlags.ExtendedDirectives | GitHub.DistributedTask.Expressions2.ExpressionFlags.AllowAnyForInsert,
Column = column,
Row = row
Row = row,
RawMapping = true
};
try {
var isWorkflow = request.TextDocument.Uri.Path.Contains("/.github/workflows/");
Expand Down
1 change: 1 addition & 0 deletions src/Runner.Language.Server/SemanticTokenHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private static TemplateContext CreateTemplateContext(GitHub.DistributedTask.Obj
FileProvider = new DefaultInMemoryFileProviderFileProvider(files.ToArray()),
TraceWriter = new GitHub.DistributedTask.ObjectTemplating.EmptyTraceWriter(),
Flags = GitHub.DistributedTask.Expressions2.ExpressionFlags.DTExpressionsV1 | GitHub.DistributedTask.Expressions2.ExpressionFlags.ExtendedDirectives | GitHub.DistributedTask.Expressions2.ExpressionFlags.AllowAnyForInsert,
RawMapping = true
};
TemplateToken? token = null;
List<int>? semTokens = null;
Expand Down
15 changes: 13 additions & 2 deletions src/Runner.Server/Controllers/MessageController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@ private HookResponse ConvertYaml2(string fileRelativePath, string content, strin
if(callingJob != null) {
callingJob.Workflowfinish.Invoke(callingJob, new WorkflowEventArgs { runid = runid, Success = false });
} else {
attempt.Status = Status.Completed;
attempt.Result = TaskResult.Skipped;
UpdateWorkflowRun(attempt, repository_name);
_context.SaveChanges();
Expand Down Expand Up @@ -2701,13 +2702,17 @@ private HookResponse ConvertYaml2(string fileRelativePath, string content, strin
} else {
WorkflowStates.Remove(runid, out _);
workflowevent?.Invoke(evargs);
attempt.Status = Status.Completed;
attempt.Result = evargs.Success ? TaskResult.Succeeded : TaskResult.Failed;
UpdateWorkflowRun(attempt, repository_name);
_context.SaveChanges();
}
_context.Dispose();
};
FinishJobController.JobCompleted withoutlock = e => {
attempt.Status = Status.Running;
_context.SaveChanges();
UpdateWorkflowRun(attempt, repository_name);
var ja = e != null ? jobs.Where(j => e.JobId == j.Id || (j.Childs?.Where(ji => e.JobId == ji.Id).Any() ?? false)).FirstOrDefault() : null;
Action<JobItem> updateStatus = job => {
job.Status = e.Result;
Expand Down Expand Up @@ -2888,6 +2893,12 @@ private HookResponse ConvertYaml2(string fileRelativePath, string content, strin
finishAsyncWorkflow(evargs);
};

var myAttempt = _context.Set<WorkflowRunAttempt>().Find(attempt.Id);
myAttempt.Status = Status.Waiting;
_context.SaveChanges();
UpdateWorkflowRun(myAttempt, repository_name);


Action<Concurrency, Action<ConcurrencyGroup>> addToConcurrencyGroup = (concurrency, action) => {
var key = $"{repository_name}/{concurrency.Group}";
while(true) {
Expand Down Expand Up @@ -7328,13 +7339,13 @@ public async Task<IActionResult> GetWorkflows([FromQuery] int? page, [FromQuery]
if(own != null && !string.IsNullOrEmpty(repo)) {
var rep = await _context.Set<Repository>().Where(r => r.Owner == own && r.Name.ToLower() == repo.ToLower()).FirstOrDefaultAsync();
if(rep != null) {
var altquery = from run in _context.Set<WorkflowRun>() from attempt in _context.Set<WorkflowRunAttempt>() where run.Id == attempt.WorkflowRun.Id && attempt.Attempt == (from a in _context.Set<WorkflowRunAttempt>() where run.Id == a.WorkflowRun.Id orderby a.Attempt descending select a.Attempt).First() && attempt.WorkflowRun.Workflow.Repository == rep orderby run.Id descending select new WorkflowRun() { EventName = attempt.EventName, Ref = attempt.Ref, Sha = attempt.Sha, Result = attempt.Result, FileName = run.FileName, DisplayName = run.DisplayName, Id = run.Id, Owner = run.Workflow.Repository.Owner.Name, Repo = run.Workflow.Repository.Name};
var altquery = from run in _context.Set<WorkflowRun>() from attempt in _context.Set<WorkflowRunAttempt>() where run.Id == attempt.WorkflowRun.Id && attempt.Attempt == (from a in _context.Set<WorkflowRunAttempt>() where run.Id == a.WorkflowRun.Id orderby a.Attempt descending select a.Attempt).First() && attempt.WorkflowRun.Workflow.Repository == rep orderby run.Id descending select new WorkflowRun() { EventName = attempt.EventName, Ref = attempt.Ref, Sha = attempt.Sha, Result = attempt.Result, Status = attempt.Status, FileName = run.FileName, DisplayName = run.DisplayName, Id = run.Id, Owner = run.Workflow.Repository.Owner.Name, Repo = run.Workflow.Repository.Name};
return await Ok(page.HasValue ? altquery.Skip(page.Value * 30).Take(30) : altquery, true);
}
}
}

var query = (from run in _context.Set<WorkflowRun>() from attempt in _context.Set<WorkflowRunAttempt>() where run.Id == attempt.WorkflowRun.Id && attempt.Attempt == (from a in _context.Set<WorkflowRunAttempt>() where run.Id == a.WorkflowRun.Id orderby a.Attempt descending select a.Attempt).First() && (string.IsNullOrEmpty(owner) || run.Workflow.Repository.Owner.Name.ToLower() == owner.ToLower()) && (string.IsNullOrEmpty(repo) || run.Workflow.Repository.Name.ToLower() == repo.ToLower()) orderby run.Id descending select new WorkflowRun() { EventName = attempt.EventName, Ref = attempt.Ref, Sha = attempt.Sha, Result = attempt.Result, FileName = run.FileName, DisplayName = run.DisplayName, Id = run.Id, Owner = run.Workflow.Repository.Owner.Name, Repo = run.Workflow.Repository.Name});
var query = (from run in _context.Set<WorkflowRun>() from attempt in _context.Set<WorkflowRunAttempt>() where run.Id == attempt.WorkflowRun.Id && attempt.Attempt == (from a in _context.Set<WorkflowRunAttempt>() where run.Id == a.WorkflowRun.Id orderby a.Attempt descending select a.Attempt).First() && (string.IsNullOrEmpty(owner) || run.Workflow.Repository.Owner.Name.ToLower() == owner.ToLower()) && (string.IsNullOrEmpty(repo) || run.Workflow.Repository.Name.ToLower() == repo.ToLower()) orderby run.Id descending select new WorkflowRun() { EventName = attempt.EventName, Ref = attempt.Ref, Sha = attempt.Sha, Result = attempt.Result, Status = attempt.Status, FileName = run.FileName, DisplayName = run.DisplayName, Id = run.Id, Owner = run.Workflow.Repository.Owner.Name, Repo = run.Workflow.Repository.Name});
return await Ok(page.HasValue ? query.Skip(page.Value * 30).Take(30) : query, true);
}

Expand Down
Loading

0 comments on commit ae3693b

Please sign in to comment.