Skip to content

Commit

Permalink
FIx support of link (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvirsegev authored May 18, 2023
1 parent 41dbb7d commit 40e536f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
10 changes: 9 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/__tests__/patch-run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Patch Run Integration Tests', () => {
operation: 'PATCH_RUN',
runId: 'r_1HDz2pBPYltPcfA1',
logMessage: 'Test message',
link: 'https://www.google.com',
link: `["https://www.google.com","https://www.google.com"]`,
},
};

Expand Down
10 changes: 9 additions & 1 deletion src/operations/UpdateRunOperation/UpdateRunOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ export default class UpdateActionOperation implements IOperation {
this.input = input;
}

private parseLinkInput = (testString: string) => {
try {
return JSON.parse(testString);
} catch (e) {
return testString;
}
};

private parseInput = (): RunToUpdate => {
if (!this.input.logMessage && !this.input.status) {
throw new Error('PATCH_RUN Operation - message or status is required');
Expand All @@ -22,7 +30,7 @@ export default class UpdateActionOperation implements IOperation {
return {
...(this.input.logMessage && { logMessage: this.input.logMessage }),
...(this.input.status && { status: this.input.status }),
...(this.input.link && { link: this.input.link }),
...(this.input.link && { link: this.parseLinkInput(this.input.link) }),
...(this.input.summary && { summary: this.input.summary }),
...(this.input.externalRunId && { externalRunId: this.input.externalRunId }),
};
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export type EntityToUpsert = Omit<Entity, 'identifier'> & {
export type RunToUpdate = {
status?: 'SUCCESS' | 'FAILURE';
logMessage?: string;
link?: string;
link?: string[];
summary?: string;
externalRunId?: string;
};
Expand Down

0 comments on commit 40e536f

Please sign in to comment.