Skip to content

Instantly share code, notes, and snippets.

@cmaster11
Created April 18, 2024 05:52
Show Gist options
  • Save cmaster11/4194a3eb80ca352e053db1e89f8368b7 to your computer and use it in GitHub Desktop.
Save cmaster11/4194a3eb80ca352e053db1e89f8368b7 to your computer and use it in GitHub Desktop.
Markdium-CDK: Force-tagging stacks with a repository name
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