@@ -230,6 +230,82 @@ func (q *Queries) GetWorkflowRunByID(ctx context.Context, db DBTX, id int64) (Wo |
| 230 | 230 | return i, err |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | +const getWorkflowRunForRepoByIndex = `-- name: GetWorkflowRunForRepoByIndex :one |
| 234 | +SELECT r.id, r.repo_id, r.run_index, r.workflow_file, r.workflow_name, |
| 235 | + r.head_sha, r.head_ref, r.event, r.event_payload, |
| 236 | + r.actor_user_id, COALESCE(u.username::text, '')::text AS actor_username, |
| 237 | + r.parent_run_id, r.concurrency_group, |
| 238 | + r.status, r.conclusion, r.pinned, r.need_approval, r.approved_by_user_id, |
| 239 | + r.started_at, r.completed_at, r.version, r.created_at, r.updated_at, r.trigger_event_id |
| 240 | +FROM workflow_runs r |
| 241 | +LEFT JOIN users u ON u.id = r.actor_user_id |
| 242 | +WHERE r.repo_id = $1 AND r.run_index = $2 |
| 243 | +` |
| 244 | + |
| 245 | +type GetWorkflowRunForRepoByIndexParams struct { |
| 246 | + RepoID int64 |
| 247 | + RunIndex int64 |
| 248 | +} |
| 249 | + |
| 250 | +type GetWorkflowRunForRepoByIndexRow struct { |
| 251 | + ID int64 |
| 252 | + RepoID int64 |
| 253 | + RunIndex int64 |
| 254 | + WorkflowFile string |
| 255 | + WorkflowName string |
| 256 | + HeadSha string |
| 257 | + HeadRef string |
| 258 | + Event WorkflowRunEvent |
| 259 | + EventPayload []byte |
| 260 | + ActorUserID pgtype.Int8 |
| 261 | + ActorUsername string |
| 262 | + ParentRunID pgtype.Int8 |
| 263 | + ConcurrencyGroup string |
| 264 | + Status WorkflowRunStatus |
| 265 | + Conclusion NullCheckConclusion |
| 266 | + Pinned bool |
| 267 | + NeedApproval bool |
| 268 | + ApprovedByUserID pgtype.Int8 |
| 269 | + StartedAt pgtype.Timestamptz |
| 270 | + CompletedAt pgtype.Timestamptz |
| 271 | + Version int32 |
| 272 | + CreatedAt pgtype.Timestamptz |
| 273 | + UpdatedAt pgtype.Timestamptz |
| 274 | + TriggerEventID string |
| 275 | +} |
| 276 | + |
| 277 | +func (q *Queries) GetWorkflowRunForRepoByIndex(ctx context.Context, db DBTX, arg GetWorkflowRunForRepoByIndexParams) (GetWorkflowRunForRepoByIndexRow, error) { |
| 278 | + row := db.QueryRow(ctx, getWorkflowRunForRepoByIndex, arg.RepoID, arg.RunIndex) |
| 279 | + var i GetWorkflowRunForRepoByIndexRow |
| 280 | + err := row.Scan( |
| 281 | + &i.ID, |
| 282 | + &i.RepoID, |
| 283 | + &i.RunIndex, |
| 284 | + &i.WorkflowFile, |
| 285 | + &i.WorkflowName, |
| 286 | + &i.HeadSha, |
| 287 | + &i.HeadRef, |
| 288 | + &i.Event, |
| 289 | + &i.EventPayload, |
| 290 | + &i.ActorUserID, |
| 291 | + &i.ActorUsername, |
| 292 | + &i.ParentRunID, |
| 293 | + &i.ConcurrencyGroup, |
| 294 | + &i.Status, |
| 295 | + &i.Conclusion, |
| 296 | + &i.Pinned, |
| 297 | + &i.NeedApproval, |
| 298 | + &i.ApprovedByUserID, |
| 299 | + &i.StartedAt, |
| 300 | + &i.CompletedAt, |
| 301 | + &i.Version, |
| 302 | + &i.CreatedAt, |
| 303 | + &i.UpdatedAt, |
| 304 | + &i.TriggerEventID, |
| 305 | + ) |
| 306 | + return i, err |
| 307 | +} |
| 308 | + |
| 233 | 309 | const insertWorkflowRun = `-- name: InsertWorkflowRun :one |
| 234 | 310 | |
| 235 | 311 | INSERT INTO workflow_runs ( |