Skip to content

Commit

Permalink
DOP-5202 update conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
anabellabuckvar committed Dec 2, 2024
1 parent d3cf291 commit c073028
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions extensions/slack/src/functions/deploy-repos.mts
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,26 @@ export default async (req: Request) => {
const [repoName, branchName] = individualRepo.value.split('/');
const jobTitle = `Slack deploy: repoName ${repoName}, branchName ${branchName}, by ${user}`;
if (repoName && branchName) {
console.log(`Deploying branch ${branchName} of repo ${repoName}`);
// Tigger build on a frontend site ('docs-frontend-dotcomstg' or 'docs-frontend-dotcomprd') depending on which modal the request was received from
// TODO: DOP-5214, change value of slash commands and their associated build hooks to env vars retrieved from dbEnvVars
const resp = await axios.post(
`https://api.netlify.com/build_hooks/673bd8c7938ade69f9530ec5?trigger_branch=main&trigger_title=deployHook+${jobTitle}`,
{ repoName: repoName, branchName: branchName },
);
return;
}
if (slackCommand === '/netlify-deploy') {
const resp = await axios.post(
`https://api.netlify.com/build_hooks/6744e9fd3344dd3955ccf135?trigger_branch=main&trigger_title=deployHook+${jobTitle}`,
{ repoName: repoName, branchName: branchName },
);
return;
if (slackCommand === '/netlify-test-deploy') {
console.log(`Deploying branch ${branchName} of repo ${repoName}`);
// Tigger build on a frontend site ('docs-frontend-dotcomstg' or 'docs-frontend-dotcomprd') depending on which modal the request was received from
// TODO: DOP-5214, change value of slash commands and their associated build hooks to env vars retrieved from dbEnvVars
const resp = await axios.post(
`https://api.netlify.com/build_hooks/673bd8c7938ade69f9530ec5?trigger_branch=main&trigger_title=deployHook+${jobTitle}`,
{ repoName: repoName, branchName: branchName },
);
return;
}
if (slackCommand === '/netlify-deploy') {
const resp = await axios.post(
`https://api.netlify.com/build_hooks/6744e9fd3344dd3955ccf135?trigger_branch=main&trigger_title=deployHook+${jobTitle}`,
{ repoName: repoName, branchName: branchName },
);
return;
}
}
throw new Error('Missing branchName or repoName');
}
throw new Error('Missing branchName or repoName');
};

// Send message to user that their job has been enqueued (DOP-5096)
Expand Down

0 comments on commit c073028

Please sign in to comment.