Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOP-4274: Label inactive branches in Slack Deploy Modal #965

Merged
merged 22 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions .github/workflows/deploy-stg-ecs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
branches:
- "master"
- "integration"
- "DOP-4274"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a reminder to remove this before merging

concurrency:
group: environment-stg-${{ github.ref }}
cancel-in-progress: true
Expand Down
22 changes: 10 additions & 12 deletions api/handlers/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,16 @@ export async function buildEntitledBranchList(entitlement: any, repoBranchesRepo
const [repoOwner, repoName, directoryPath] = repo.split('/');
const branches = await repoBranchesRepository.getRepoBranches(repoName, directoryPath);
for (const branch of branches) {
if ('buildsWithSnooty' in branch) {
const buildWithSnooty = branch['buildsWithSnooty'];
if (buildWithSnooty) {
const active = branch['active'];
const repoPath = `${repoOwner}/${repoName}${directoryPath ? '/' + directoryPath : ''}/${
branch['gitBranchName']
}`;
if (!active) {
entitledBranches.push(`!Inactive ` + `${repoPath}`);
} else {
entitledBranches.push(repoPath);
}
const buildWithSnooty = branch['buildsWithSnooty'];
if (buildWithSnooty) {
const active = branch['active'];
const repoPath = `${repoOwner}/${repoName}${directoryPath ? '/' + directoryPath : ''}/${
branch['gitBranchName']
}`;
if (!active) {
entitledBranches.push(`(!inactive) ${repoPath}`);
} else {
entitledBranches.push(repoPath);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/services/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,9 @@ export class SlackConnector implements ISlackConnector {
branches.forEach((fullPath) => {
const displayBranchPath = fullPath;
let valueBranchPath = fullPath;
const inactiveStr = /!inactive/gi;
const isInactive = fullPath.search(inactiveStr);
if (isInactive != -1) {
valueBranchPath = fullPath.slice(10);
const isInactive = fullPath.startsWith('(!inactive)');
if (isInactive == true) {
valueBranchPath = fullPath.slice(12);
}
const opt = {
text: {
Expand Down
Loading