{"id":28930680,"url":"https://github.com/karlderkaefer/cdk-notifier","last_synced_at":"2026-03-02T10:10:33.228Z","repository":{"id":37784754,"uuid":"401646139","full_name":"karlderkaefer/cdk-notifier","owner":"karlderkaefer","description":"CLI tool to post AWS CDK diff as comment to Github pull request","archived":false,"fork":false,"pushed_at":"2026-02-01T01:14:31.000Z","size":944,"stargazers_count":128,"open_issues_count":3,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T12:50:48.069Z","etag":null,"topics":["aws","aws-cdk","cdk","circleci","cli","comment","diff","github"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karlderkaefer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"patreon":"karlderkaefer","custom":["https://www.paypal.me/ktheil"]}},"created_at":"2021-08-31T09:30:07.000Z","updated_at":"2026-02-01T01:14:31.000Z","dependencies_parsed_at":"2023-02-17T05:01:10.698Z","dependency_job_id":"266d43bc-6929-4e9d-94df-47a9ebd5972d","html_url":"https://github.com/karlderkaefer/cdk-notifier","commit_stats":null,"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"purl":"pkg:github/karlderkaefer/cdk-notifier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlderkaefer%2Fcdk-notifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlderkaefer%2Fcdk-notifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlderkaefer%2Fcdk-notifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlderkaefer%2Fcdk-notifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karlderkaefer","download_url":"https://codeload.github.com/karlderkaefer/cdk-notifier/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karlderkaefer%2Fcdk-notifier/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28981893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T15:35:50.179Z","status":"ssl_error","status_checked_at":"2026-02-01T15:35:38.075Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-cdk","cdk","circleci","cli","comment","diff","github"],"created_at":"2025-06-22T15:10:13.652Z","updated_at":"2026-02-01T16:01:33.084Z","avatar_url":"https://github.com/karlderkaefer.png","language":"Go","readme":"# cdk-notifier\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n[![CircleCI](https://circleci.com/gh/circleci/circleci-docs.svg?style=shield)](https://circleci.com/gh/circleci/circleci-docs)\n[![codecov](https://codecov.io/gh/karlderkaefer/cdk-notifier/branch/main/graph/badge.svg?token=C0BGW4EUOX)](https://codecov.io/gh/karlderkaefer/cdk-notifier)\n[![Go Report Card](https://goreportcard.com/badge/github.com/karlderkaefer/cdk-notifier)](https://goreportcard.com/report/github.com/karlderkaefer/cdk-notifier)\n\nlightweight CLI tool to parse a CDK log file and post changes to pull request requests.\nCan be used to get more confidence on approving pull requests because reviewer will be aware of changes done to your\nenvironments.\n\n[Medium Article](https://betterprogramming.pub/improve-your-pull-request-experience-for-aws-cdk-projects-1fd5adb08bb3)\n\n## Install\n\nInstall binary with latest release\n\n```bash\ncurl -L \"https://github.com/karlderkaefer/cdk-notifier/releases/latest/download/cdk-notifier_$(uname)_amd64.gz\" -o cdk-notifier.gz\ngunzip cdk-notifier.gz \u0026\u0026 chmod +x cdk-notifier \u0026\u0026 rm -rf cdk-notifier.gz\nsudo mv cdk-notifier /usr/local/bin/cdk-notifier\n```\n\nCheck Version and help\n\n```bash\ncdk-notifier --version\n# 1.0.1\n\ncdk-notifier --help\n                                                 \n# Post CDK diff log to Pull Request\n\n# Usage:\n#   cdk-notifier [flags]\n\n# Flags:\n#       --ci string                CI System used [circleci|bitbucket|gitlab] (default \"circleci\")\n#       --custom-template string   File path or string input to custom template. When set it will override the template flag.\n#   -d, --delete                   delete comments when no changes are detected for a specific tag id (default true)\n#       --disable-collapse         Collapsible comments are enabled by default for GitHub and GitLab. When set to true it will not use collapsed sections.\n#       --github-host string       Optional set host for GitHub Enterprise\n#       --gitlab-url string        Optional set gitlab url (default \"https://gitlab.com/\")\n#   -h, --help                     help for cdk-notifier\n#   -l, --log-file string          path to cdk log file\n#       --no-post-mode             Optional do not post comment to VCS, instead write additional file and print diff to stdout\n#   -o, --owner string             Name of owner. If not set will lookup for env var [REPO_OWNER|CIRCLE_PROJECT_USERNAME|BITBUCKET_REPO_OWNER]\n#   -p, --pull-request-id string   Id or URL of pull request. If not set will lookup for env var [PR_ID|CIRCLE_PULL_REQUEST|BITBUCKET_PR_ID|CI_MERGE_REQUEST_IID]\n#   -r, --repo string              Name of repository without organisation. If not set will lookup for env var [REPO_NAME|CIRCLE_PROJECT_REPONAME|BITBUCKET_REPO_SLUG],'\n#       --show-overview            [Deprected: use template extended instead] Show Overview are disabled by default. When set to true it will show the number of cdk stacks with diff and  the number of replaced resources in the overview section.\n#   -t, --tag-id string            unique identifier for stack within pipeline (default \"stack\")\n#       --template string          Template to use for comment [default|extended|extendedWithResources] (default \"default\")\n#       --token string             Authentication token used to post comments to PR. If not set will lookup for env var [TOKEN_USER|GITHUB_TOKEN|BITBUCKET_TOKEN|GITLAB_TOKEN]\n#   -u, --user string              Optional set username for token (required for bitbucket)\n#       --vcs string               Version Control System [github|github-enterprise|bitbucket|gitlab] (default \"github\")\n#   -v, --verbosity string         Log level (debug, info, warn, error, fatal, panic) (default \"info\")\n#       --version                  version for cdk-notifier\n\n```\n\n### Using docker\n\nThe docker image is available on [dockerhub](https://hub.docker.com/r/karlderkaefer/cdk-notifier).\n\nAs alternative to passing arguments to cli you can create a env file with required variables, this is an example for github.\n\n```bash\ncat \u003c\u003cEOF \u003e docker.env\nREPO_OWNER=karlderkaefer\nPR_ID=156\nREPO_NAME=cdk-notifier\nGITHUB_TOKEN=***\nEOF\n```\n\nThen you can run the docker image with the env file.\n\n```bash\ndocker run -v $(pwd)/data:/data --env-file docker.env karlderkaefer/cdk-notifier -l /data/cdk-diff1.log\n$ time=\"2024-04-14T14:57:50Z\" level=info msg=\"Created comment with id 2054088709 and tag id stack https://github.com/karlderkaefer/cdk-notifier/pull/156#issuecomment-2054088709\"\n```\n\n## Usage\n\nFirst create the output of cdk diff to file. You can stream cdk diff to stdout and to file with following.\nThis tool most like runs in a CI environment. To\navoid [printing millions of lines](https://github.com/aws/aws-cdk/issues/8893#issuecomment-654296389) you add progress\nflag.\n\n```bash\ncdk diff --progress=events \u0026\u003e \u003e(tee cdk.log)\n```\n\ncdk-notifier will then analyze and transform the log by\n\n* remove ASCII colors\n* prepare additions and deletion for GitHub markdown diff\n* truncate log if\n  exceeding [max length of body for comment](https://github.community/t/maximum-length-for-the-comment-body-in-issues-and-pr/148867/2)\n  and then send\n\ncdk-notifier will post the processed log of cdk diff to PR if there are changes.\nIf a diff comment for tag-id exists and no changes are detected then comment will delete.\nYou can control this behavior with `--delete=false`.\n\n```bash\ncdk-notifier --owner some-org --repo some-repo --token 1234 --log-file ./cdk.log --tag-id my-stack --pull-request-id 12 --vcs github --ci circleci\n```\n\nThe `tag-id` has to be unique within one pipeline. It's been used to identify the comment to update or delete.\n\nThis is an example how the diff would like on github\n\n```bash\ncdk-notifier -l data/cdk-small.log -t test\n```\n\nPlease note: GitLab, Bitbucket or Github tokens needs permission to write comments to PR.\nAs an example for GitHub PAT it requires `pull requests: read and write`.\n\n![](images/diff.png)\n\n### Github Enterprise\n\nTo use CDK-Notifier with Github Enterprise you need to set `--vcs github-enterprise` and `--github-host https://github.your-company.com`.\n\n```bash\ncdk-notifier -l data/cdk-diff1.log -t test --vcs github-enterprise --github-host https://github.your-company.com\n```\n\nIn case you run a CircleCI Pipeline you can omit `--github-host`. It will detected from environment variable `CIRCLE_PULL_REQUEST` which follows the format `https://github.your-company.com/owner/repo/pull/1`\n\nThanks to [@mmogylenko](https://github.com/mmogylenko) for providing this feature.\n\n### Bitbucket\n\nTo use cdk-notifier with Bitbucket you need to set `--vcs bitbucket` and `--user \u003cusername\u003e`.\nThe username is required and is the name of the user who created the token.\nAlternatively you can use the environment variable `TOKEN_USER`. This is an example with all options set.\n\n```bash\ncdk-notifier -l data/cdk-diff1.log -t test --vcs bitbucket --token \u003ctoken\u003e --owner \u003cowner\u003e --repo \u003crepo\u003e --pull-request-id \u003cpr-id\u003e\n```\n\nIt's also possible to use [Workspace Access tokens](https://support.atlassian.com/bitbucket-cloud/docs/workspace-access-tokens/)\nby just passing the `--token`.\n\n## Support for CI Systems\n\nCDK-Notifier is supporting following Version Control Systems\n\n* github | github-enterprise\n* bitbucket\n* gitlab\n\nIf you run CDK-Notifier on CI Systems, you may not need to set flag for `owner`, `repo` or `pull-request-id`.\nThose will be read in automatically if not set via cli args. See [priority mapping](#config-priority-mapping).\nFollowing matrix is showing support for automatic mapping for different CI Systems.\n\n| Version Control System | CirlceCi Support   | Bitbucket CI Support | Github CI Support | Gitlab CI Support  |\n|------------------------|--------------------|----------------------|-------------------|--------------------|\n| github                 | :heavy_check_mark: | :heavy_check_mark:   | :x:               | :x:                |\n| bitbucket              | :heavy_check_mark: | :heavy_check_mark:   | :x:               | :x:                |\n| gitlab                 | :x:                | :x:                  | :x:               | :heavy_check_mark: |\n\nIf you run cdk-notifier on CircleCi you don't need to set owner, repo or token.\nCircleCi will provide default variables which will read in by cdk-notifier when cli arg is not set.\n\nExample when running on CircleCi. See [available build variables](https://circleci.com/docs/env-vars#built-in-environment-variables)\n```bash\nCIRCLE_PR_NUMBER\nCIRCLE_PROJECT_REPONAME\nCIRCLE_PROJECT_USERNAME\n```\n\nExample when running on BitBucket CI. See [available build variables](https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/)\n```bash\nBITBUCKET_PR_ID\nBITBUCKET_REPO_OWNER\nBITBUCKET_REPO_SLUG\n```\n\nExample when running on Gitlab CI. See [available build variables](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html)\n```bash\nCI_MERGE_REQUEST_IID\nCI_PROJECT_NAMESPACE\nCI_PROJECT_NAME\n```\n\nToken and usernames will be read in automatically despite on which CI they run. Potentially they override each other in order listed below.\n\n```bash\nTOKEN\nGITHUB_TOKEN\nBITBUCKET_TOKEN\nGITLAB_TOKEN\n```\n\n### Custom Comment Template\n\nYou can choose the comment template by using the `--template` flag. Possible values are `default`, `extended` or `extendedWithResources`.\n\n```bash\n# show overview stats like number of resources replaced and number of changed stacks\ncdk-notifier --template extendedWithResources\n```\n\n![example template extended](images/template-extended-with-resources.png)\n\nOptionally you can full customize the message by setting the flag `--custom-template` that points to a file with desired template.\nYou can use the [default template](./transform/template.go) as an reference. [Sprig](https://github.com/Masterminds/sprig) functions are supported in custom templates.\nAs alternative you can also set a multiline environment variable `CUSTOM_TEMPLATE`.\n\n```bash\nexport CUSTOM_TEMPLATE=\"\n{{ .HeaderPrefix }} {{ .TagID }} {{ .JobLink }}\nmy custom template\n{{ .Backticks }}diff\n{{ .Content }}\n{{ .Backticks }}\n\"\n```\n\n## Config Priority Mapping\nThe config for CDK-Notifier is mapping in following priority (from low to high)\n1. Environment Variables of Map Struct. For full list of Envs please check [code](https://github.com/karlderkaefer/cdk-notifier/blob/7e8b72d91096f7ee1c3fc1d97fb68ab84a129bc2/cmd/root.go#L109-L130)\n    ```\n    REPO_NAME\n    REPO_OWNER\n    TOKEN\n    TOKEN_USER\n    PR_ID\n    LOG_FILE\n    TAG_ID\n    DELETE_COMMENT\n    VERSION_CONTROL_SYSTEM\n    CI_SYSTEM\n    ```\n2. CI System specific environment variable mapping. See [support-for-ci-systems](#support-for-ci-systems)\n3. Default values for CLI args. See `cdk-notifier --help`\n4. Values set by CLI e.g. `--token`\n\n## No Post Mode\n\nIn case you only want to do the transformation into markdown diff, as described in [issue#46](https://github.com/karlderkaefer/cdk-notifier/issues/46).\n```bash\n./cdk-notifier -l data/cdk-diff1.log --tag-id small --no-post-mode\n```\nAny validation is skipped, you only need to set `--log-file` and `--tag-id`.\nEnable this option `--no-post-mode` will write the markdown diff to stdout and a logfile.\nThe diff output file is using same path of cdk log file, but is appending `.diff` extension.\n\n## Suppress Hash Changes\n\nSee github issue [issue#125](https://github.com/karlderkaefer/cdk-notifier/issues/125).\nIn case you want to suppress any hash changes in the diff, you can use the flag `--suppress-hash-changes`.\nFor example this would not post a diff for any changes in the hash of the resources [see example](./data/cdk-diff-resources-changes.log). You can override the regex that is used to detect hash changes with the flag `--suppress-hash-changes-regex` or setting the Environment Variable `SUPPRESS_HASH_CHANGES_REGEX`. This improvement was requested by [@wolverian](https://github.com/wolverian) in [issue#188](https://github.com/karlderkaefer/cdk-notifier/issues/188)\n\n```bash\ncdk-notifier -l data/cdk-suppress-regex.log --tag-id test --suppress-hash-changes --suppress-hash-changes-regex \"^[+-].*?[a-fA-F0-9]{40}\"\n```\n\n## Security\n**Disclaimer**: Consider using on private repositories only.\n\nThe CDK log does not contain sensitive information by default. However, someone can argue the account id is considered as sensitive information.\nCDK-Notifier does also not benefit from the automatic obscuring you may see in CI logs when using secret environment variables. \n\n## Versioning\n\nUse [Conventional Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/).\n[Semantic Release](https://github.com/semantic-release/semantic-release) will release a new version with changelog.\n\nexamples:\n\n``` \n# increase patch version\nfix: fixing tests\n\n# incease minor version\nfeat: add configuration\n\n# increase major version:\nfeat: remove comments api\n\nBREAKING CHANGE: remove comments api\n\n# update docu\ndocs: update readme\n```\n\n\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://shawn.vause.us\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/8197405?v=4?s=100\" width=\"100px;\" alt=\"Shawn Vause\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eShawn Vause\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/karlderkaefer/cdk-notifier/commits?author=napalm684\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://maroto.me\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/701909?v=4?s=100\" width=\"100px;\" alt=\"Jorge Maroto\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJorge Maroto\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/karlderkaefer/cdk-notifier/commits?author=patoroco\" title=\"Documentation\"\u003e📖\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/mmogylenko\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/7536624?v=4?s=100\" width=\"100px;\" alt=\"Mykola Mogylenko\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eMykola Mogylenko\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/karlderkaefer/cdk-notifier/commits?author=mmogylenko\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/peter-svensson\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/378483?v=4?s=100\" width=\"100px;\" alt=\"Peter Svensson\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePeter Svensson\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/karlderkaefer/cdk-notifier/commits?author=peter-svensson\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://johanneskonings.dev/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/14806640?v=4?s=100\" width=\"100px;\" alt=\"Johannes Konings\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJohannes Konings\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/karlderkaefer/cdk-notifier/commits?author=JohannesKonings\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/joshmyers\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/3025844?v=4?s=100\" width=\"100px;\" alt=\"Josh Myers\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJosh Myers\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/karlderkaefer/cdk-notifier/commits?author=joshmyers\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","funding_links":["https://patreon.com/karlderkaefer","https://www.paypal.me/ktheil"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlderkaefer%2Fcdk-notifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarlderkaefer%2Fcdk-notifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarlderkaefer%2Fcdk-notifier/lists"}