Skip to content

Commit f0aa195

Browse files
Arc 2643 workflow log (#2583)
1 parent b75d2b4 commit f0aa195

File tree

7 files changed

+12
-13
lines changed

7 files changed

+12
-13
lines changed

src/github/workflow.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("Workflow Webhook", () => {
6363
[
6464
{
6565
schemaVersion: "1.0",
66-
pipelineId: 9751894,
66+
pipelineId: "9751894",
6767
buildNumber: 84,
6868
updateSequenceNumber: 12345678,
6969
displayName: "My Deployment flow",

src/interfaces/github.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,11 @@ interface GitHubWorkflowRun {
161161
// Can be null according to https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28 (see response schema)
162162
head_commit: GitHubWorkflowRunHeadCommit | null;
163163
repository: GitHubWorkflowRunRepository;
164-
}
165-
166-
interface GitHubWorkflow {
167-
id: string;
164+
workflow_id: number;
168165
}
169166

170167
export interface GitHubWorkflowPayload {
171168
workflow_run: GitHubWorkflowRun;
172-
workflow: GitHubWorkflow;
173169
}
174170

175171
interface GitHubData {

src/jira/client/jira-client-audit-log-helper.ts

+1
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export const processAuditLogsForWorkflowSubmit = (
204204
options: options,
205205
logger
206206
});
207+
207208
if (isSuccess) {
208209
auditInfo?.map(async (auditInf) => {
209210
await saveAuditLog(auditInf, logger);

src/jira/client/jira-client.ts

+1
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ export const getJiraClient = async (
407407
operationType: options?.operationType || "NORMAL"
408408
};
409409

410+
logger.info("Posting backfill workflow info for " , { repositoryId, repoFullName, data });
410411
const response = await instance.post("/rest/builds/0.1/bulk", payload);
411412
const responseData = {
412413
status: response.status,

src/sync/build.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe("sync/builds", () => {
9494
createJiraNock([
9595
{
9696
"schemaVersion": "1.0",
97-
"pipelineId": 2152266464,
97+
"pipelineId": "19236895",
9898
"buildNumber": 59,
9999
"updateSequenceNumber": 12345678,
100100
"displayName": "Build",
@@ -249,7 +249,7 @@ describe("sync/builds", () => {
249249
createJiraNock([
250250
{
251251
"schemaVersion": "1.0",
252-
"pipelineId": 2152266464,
252+
"pipelineId": "19236895",
253253
"buildNumber": 59,
254254
"updateSequenceNumber": 12345678,
255255
"displayName": "Build",
@@ -274,7 +274,7 @@ describe("sync/builds", () => {
274274
},
275275
{
276276
"schemaVersion": "1.0",
277-
"pipelineId": 2152266464,
277+
"pipelineId": "19236895",
278278
"buildNumber": 59,
279279
"updateSequenceNumber": 12345678,
280280
"displayName": "Build",

src/sync/build.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ type BuildWithCursor = { cursor: string } & Octokit.ActionsListRepoWorkflowRunsR
1414

1515
// TODO: add types
1616
const getTransformedBuilds = async (workflowRun, gitHubInstallationClient, alwaysSend: boolean, logger) => {
17-
const transformTasks = workflowRun.map(workflow => {
18-
const workflowItem = { workflow_run: workflow, workflow: { id: workflow.id } } as GitHubWorkflowPayload;
17+
const transformTasks = workflowRun.map(workflowRun => {
18+
const workflowItem = { workflow_run: workflowRun } as GitHubWorkflowPayload;
1919
return transformWorkflow(gitHubInstallationClient, workflowItem, alwaysSend, logger);
2020
});
2121

src/transforms/transform-workflow.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ export const transformWorkflow = async (
6262
head_branch,
6363
html_url,
6464
name,
65+
workflow_id,
6566
pull_requests,
6667
repository,
6768
run_number,
6869
status,
6970
updated_at
70-
}, workflow
71+
}
7172
} = payload;
7273

7374
const workflowHasPullRequest = !!pull_requests?.length;
@@ -95,7 +96,7 @@ export const transformWorkflow = async (
9596
builds: [
9697
{
9798
schemaVersion: "1.0",
98-
pipelineId: workflow.id,
99+
pipelineId: String(workflow_id),
99100
buildNumber: run_number,
100101
updateSequenceNumber: Date.now(),
101102
displayName: name,

0 commit comments

Comments
 (0)