Skip to content

Commit

Permalink
Merge pull request #93 from guardian/aa/whats-on
Browse files Browse the repository at this point in the history
feat: Add a link to understand what's currently deployed
  • Loading branch information
akash1810 authored Dec 6, 2023
2 parents 2e8038d + 604fb24 commit c01ad2c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63728,13 +63728,20 @@ function getPreviewUrl(config) {
url.searchParams.set("updateStrategy", "MostlyHarmless");
return url;
}
function getWhatsOnUrl(config) {
const url = new URL("https://riffraff.gutools.co.uk/deployment/history");
url.searchParams.set("projectName", config.projectName);
url.searchParams.set("stage", config.commentingStage);
return url;
}
var marker = (projectName) => {
return `<!-- guardian/actions-riff-raff for ${projectName} -->`;
};
function getCommentMessage(config) {
const { buildNumber, commentingStage, projectName } = config;
const deployUrl = getDeployUrl(config).toString();
const previewUrl = getPreviewUrl(config).toString();
const whatsOnUrl = getWhatsOnUrl(config).toString();
const mainMessage = `[Deploy build ${buildNumber} of \`${projectName}\` to ${commentingStage}](${deployUrl})`;
return [
`### ${mainMessage}`,
Expand All @@ -63743,6 +63750,7 @@ function getCommentMessage(config) {
"",
`- ${mainMessage}`,
`- [Deploy parts of build ${buildNumber} to ${commentingStage} by previewing it first](${previewUrl})`,
`- [What's on ${commentingStage} right now?](${whatsOnUrl})`,
"</details>",
"",
"---",
Expand Down
11 changes: 11 additions & 0 deletions src/pr-comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ function getPreviewUrl(config: PullRequestCommentConfig): URL {
return url;
}

function getWhatsOnUrl(config: PullRequestCommentConfig): URL {
const url = new URL('https://riffraff.gutools.co.uk/deployment/history');

url.searchParams.set('projectName', config.projectName);
url.searchParams.set('stage', config.commentingStage);

return url;
}

const marker = (projectName: string) => {
return `<!-- guardian/actions-riff-raff for ${projectName} -->`;
};
Expand All @@ -33,6 +42,7 @@ function getCommentMessage(config: PullRequestCommentConfig): string {
const { buildNumber, commentingStage, projectName } = config;
const deployUrl = getDeployUrl(config).toString();
const previewUrl = getPreviewUrl(config).toString();
const whatsOnUrl = getWhatsOnUrl(config).toString();

const mainMessage = `[Deploy build ${buildNumber} of \`${projectName}\` to ${commentingStage}](${deployUrl})`;

Expand All @@ -43,6 +53,7 @@ function getCommentMessage(config: PullRequestCommentConfig): string {
'',
`- ${mainMessage}`,
`- [Deploy parts of build ${buildNumber} to ${commentingStage} by previewing it first](${previewUrl})`,
`- [What's on ${commentingStage} right now?](${whatsOnUrl})`,
'</details>',
'',
'---',
Expand Down

0 comments on commit c01ad2c

Please sign in to comment.