Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function linkToSha(id: RemoteRepoRef, sha: string) {
return slack.url(id.url + "/tree/" + sha, sha.substr(0, 6));
}
function linkToSha(id: RemoteRepoRef) {
return slack.url(id.url + "/tree/" + id.sha,
`${id.owner}/${id.repo}#${id.sha.substr(0, 6)}`);
}
function linkToSha(id: RemoteRepoRef) {
return slack.url(id.url + "/tree/" + id.sha, id.sha.substr(0, 6));
}
export function linkToDiff(id: RemoteRepoRef, start: string, end: string, endDescription?: string) {
return slack.url(diffUrl(id, start, end), `(Compare with ${endDescription || end.substr(0, 6)})`);
}
export async function presentPromotionInformation(inv: VerifiedDeploymentInvocation) {
const shaLink = slack.url(inv.id.url + "/tree/" + inv.id.sha, inv.id.repo);
const endpointLink = slack.url(inv.status.targetUrl);
const messageId = `httpService:promote:prod/${inv.id.repo}/${inv.id.owner}/${inv.id.sha}`;
const currentlyRunning = await runningAttachment(inv.context,
(inv.credentials as TokenCredentials).token,
inv.id as GitHubRepoRef,
{domain: K8sProductionDomain, color: ProductionMauve}, inv.id.sha);
const message: slack.SlackMessage = {
attachments: currentlyRunning,
};
return inv.context.messageClient.send(message, inv.messageDestination, {id: messageId});
}
export async function presentPromotionInformation(inv: VerifiedDeploymentInvocation) {
const shaLink = slack.url(inv.id.url + "/tree/" + inv.id.sha, inv.id.repo);
const endpointLink = slack.url(inv.status.targetUrl);
const messageId = `httpService:promote:prod/${inv.id.repo}/${inv.id.owner}/${inv.id.sha}`;
const currentlyRunning = await runningAttachment(inv.context,
(inv.credentials as TokenCredentials).token,
inv.id as GitHubRepoRef,
{domain: K8sProductionDomain, color: ProductionMauve}, inv.id.sha);
const message: slack.SlackMessage = {
attachments: currentlyRunning,
};
return inv.context.messageClient.send(message, inv.messageDestination, {id: messageId});
}