@@ -13,12 +13,17 @@ import * as path from "path";
1313
1414import * as actionsCache from "@actions/cache" ;
1515
16- import { getTemporaryDirectory } from "../actions-util" ;
16+ import {
17+ getTemporaryDirectory ,
18+ getWorkflowRunAttempt ,
19+ getWorkflowRunID ,
20+ } from "../actions-util" ;
1721import { type CodeQL } from "../codeql" ;
1822import { Logger } from "../logging" ;
1923import {
2024 DiskUsage ,
2125 getErrorMessage ,
26+ getRequiredEnvParam ,
2227 waitForResultWithTimeLimit ,
2328} from "../util" ;
2429
@@ -38,12 +43,38 @@ function getStatusFilePath(languages: string[]): string {
3843 ) ;
3944}
4045
46+ /** Details of the job that recorded an overlay status. */
47+ interface JobInfo {
48+ /** The workflow run ID. */
49+ workflowRunId : number ;
50+ /** The workflow run attempt number. */
51+ workflowRunAttempt : number ;
52+ /** The name of the job (from GITHUB_JOB). */
53+ name : string ;
54+ }
55+
4156/** Status of an overlay analysis for a group of languages. */
4257export interface OverlayStatus {
4358 /** Whether the job attempted to build an overlay base database. */
4459 attemptedToBuildOverlayBaseDatabase : boolean ;
4560 /** Whether the job successfully built an overlay base database. */
4661 builtOverlayBaseDatabase : boolean ;
62+ /** Details of the job that recorded this status. */
63+ job ?: JobInfo ;
64+ }
65+
66+ /** Creates an `OverlayStatus` populated with the details of the current job. */
67+ export function createOverlayStatus (
68+ attributes : Omit < OverlayStatus , "job" > ,
69+ ) : OverlayStatus {
70+ return {
71+ ...attributes ,
72+ job : {
73+ workflowRunId : getWorkflowRunID ( ) ,
74+ workflowRunAttempt : getWorkflowRunAttempt ( ) ,
75+ name : getRequiredEnvParam ( "GITHUB_JOB" ) ,
76+ } ,
77+ } ;
4778}
4879
4980/**
0 commit comments