Created
April 18, 2024 05:52
-
-
Save cmaster11/4194a3eb80ca352e053db1e89f8368b7 to your computer and use it in GitHub Desktop.
Markdium-CDK: Force-tagging stacks with a repository name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import simpleGit from 'simple-git'; | |
export async function getSynthesizer(synthProps?: cdk.DefaultStackSynthesizerProps) { | |
// Extract the current repository name | |
const remoteUrl = (await simpleGit().remote(['get-url', 'origin']))!.trim(); | |
const repository = /github.com[:/]([^/]+\/[^/]+)\.git/.exec(remoteUrl)![1]; | |
return new KiwiSynthesizer({ | |
...synthProps, | |
forcedTags: { | |
Repository: repository | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment