Skip to content

Commit

Permalink
feat: Add a link to understand what's currently deployed
Browse files Browse the repository at this point in the history
Before deploying, one might want to check if the previous occupant has finished their work.
  • Loading branch information
akash1810 committed Dec 6, 2023
1 parent 2e8038d commit 604fb24
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 604fb24

Please sign in to comment.