Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions actions/submit-signing-request/connector-url-builder.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
export class ConnectorUrlBuilder {
private readonly apiVersion: string = "1.0";
private readonly baseSigningRequestsRoute: string;

constructor(private readonly connectorBaseUrl: string, private readonly organizationId: string) {
this.connectorBaseUrl = this.trimSlash(this.connectorBaseUrl);
this.baseSigningRequestsRoute = `${this.connectorBaseUrl}/${encodeURIComponent(this.organizationId)}/SigningRequests`
}

public buildSubmitSigningRequestUrl(): string {
return `${this.baseSigningRequestsRoute}?api-version=${this.apiVersion}`
}

public buildGetSigningRequestStatusUrl(signingRequestId: string): string {
return `${this.baseSigningRequestsRoute}/${encodeURIComponent(signingRequestId)}/Status?api-version=${this.apiVersion}`
}

public buildGetSignedArtifactUrl(signingRequestId: string): string {
return `${this.baseSigningRequestsRoute}/${encodeURIComponent(signingRequestId)}/SignedArtifact?api-version=${this.apiVersion}`
}

private trimSlash(text: string): string {
if (text && text[text.length - 1] === '/') {
return text.substring(0, text.length - 1);
}
return text;
}
}
6 changes: 6 additions & 0 deletions actions/submit-signing-request/dtos/signing-request-status.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface SigningRequestStatusDto {
status: string;
isFinalStatus: boolean;
webLink: string;
hasArtifactBeenDownloadedBySignPathInCaseOfArtifactRetrieval: boolean;
}
9 changes: 0 additions & 9 deletions actions/submit-signing-request/dtos/signing-request.ts

This file was deleted.

17 changes: 7 additions & 10 deletions actions/submit-signing-request/helper-artifact-download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';
import * as nodeStreamZip from 'node-stream-zip';
import axios, { AxiosError } from 'axios';
import { HelperInputOutput } from "./helper-input-output";
import { buildSignPathAuthorizationHeader, httpErrorResponseToText } from './utils';
import { httpErrorResponseToText } from './utils';
import { TimeoutStream } from './timeout-stream';


Expand All @@ -19,14 +19,11 @@ export class HelperArtifactDownload {

const response = await axios.get(artifactDownloadUrl, {
responseType: 'stream',
timeout: timeoutMs,
headers: {
Authorization: buildSignPathAuthorizationHeader(this.helperInputOutput.signPathApiToken)
}
timeout: timeoutMs
})
.catch((e: AxiosError) => {
throw new Error(httpErrorResponseToText(e));
});
.catch((e: AxiosError) => {
throw new Error(httpErrorResponseToText(e));
});

const targetDirectory = this.resolveOrCreateDirectory(this.helperInputOutput.outputArtifactDirectory);

Expand Down Expand Up @@ -67,8 +64,8 @@ export class HelperArtifactDownload {
core.info(`The signed artifact has been successfully downloaded from SignPath and extracted to ${targetDirectory}`);
}

public resolveOrCreateDirectory(directoryPath:string): string {
const workingDirectory = process.env.GITHUB_WORKSPACE as string;
public resolveOrCreateDirectory(directoryPath: string): string {
const workingDirectory = process.env.GITHUB_WORKSPACE as string;
const absolutePath = path.isAbsolute(directoryPath) ? directoryPath :
path.join(workingDirectory as string, directoryPath);

Expand Down
4 changes: 0 additions & 4 deletions actions/submit-signing-request/helper-input-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,4 @@ export class HelperInputOutput {
setSigningRequestWebUrl(signingRequestUrl: string): void {
core.setOutput('signing-request-web-url', signingRequestUrl);
}

setSignPathApiUrl(signingRequestUrl: string): void {
core.setOutput('signpath-api-url', signingRequestUrl);
}
}
29 changes: 0 additions & 29 deletions actions/submit-signing-request/signpath-url-builder.ts

This file was deleted.

Loading
Loading