{"id":24965724,"url":"https://github.com/shiftcode/delete-orphan-cfn-stacks-action","last_synced_at":"2025-09-15T06:13:42.105Z","repository":{"id":42662124,"uuid":"357476821","full_name":"shiftcode/delete-orphan-cfn-stacks-action","owner":"shiftcode","description":"GitHub workflow action to delete orphan aws CloudFormation stacks","archived":false,"fork":false,"pushed_at":"2024-01-26T12:50:42.000Z","size":2038,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-03T11:15:16.999Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shiftcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-04-13T08:20:08.000Z","updated_at":"2022-05-01T23:34:54.000Z","dependencies_parsed_at":"2025-02-03T11:15:23.464Z","dependency_job_id":"5bf51075-60e9-49f0-a9c3-ee796330f62b","html_url":"https://github.com/shiftcode/delete-orphan-cfn-stacks-action","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftcode%2Fdelete-orphan-cfn-stacks-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftcode%2Fdelete-orphan-cfn-stacks-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftcode%2Fdelete-orphan-cfn-stacks-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftcode%2Fdelete-orphan-cfn-stacks-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiftcode","download_url":"https://codeload.github.com/shiftcode/delete-orphan-cfn-stacks-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246122443,"owners_count":20726830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2025-02-03T11:15:17.800Z","updated_at":"2025-03-29T01:19:19.072Z","avatar_url":"https://github.com/shiftcode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Delete orphan CloudFormation stacks action\n![version](https://img.shields.io/github/last-commit/shiftcode/delete-orphan-cfn-stacks-action)\n![version](https://img.shields.io/github/tag/shiftcode/delete-orphan-cfn-stacks-action?label=version)\n\n\nThis action deletes all cloudformation xx/pr stacks in the provided region with the given name prefix when there's no corresponding branch.\\\nThe stage is transformed from the branch name (eg. `#85-my-feature` \u003e `xx85` / `pr85`).\\\n`master`/`main` stack is always ignored.\n\nMake sure your CloudFormation Stacks are fully deletable (if autoDeleteBuckets=true also autoDeleteItems, etc.)\n\n## Usage\n### Inputs\n\n#### `githubToken`\n**Required** `string` The github access token with scope `repo`\n\n#### `stackNamePrefix`\n**Required** `string` The prefix of the stack names to delete.\n\n#### `ignoreStacks`\n**Optional** `JSON String Array` of stack identifiers to ignore. `master` and `main` stack is always ignored.\n\n#### `dryMode`\n**Optional** `boolean` default false. If true no stacks will be deleted. Only output the detected orphans.\n\n### Example workflow step config\n```\n- name: Configure AWS Credentials\n  uses: aws-actions/configure-aws-credentials@v4\n  with:\n    role-to-assume: 'arn:aws:iam::{ACCOUNT_ID}:role/{ROLE_NAME}'\n    aws-region: {AWS_REGION}\n- name: Delete Orphan Stacks\n  uses: shiftcode/delete-orphan-cfn-stacks-action@v0.0.X\n  with:\n    githubToken: 'ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'\n    stackNamePrefix: 'ch-website'\n    ignoreStacks: '[\"xx1\"]'\n```\n### Hints\n- if there are stacks in multiple regions: use both actions two times with their corresponding region.\n- if working with `assumedRoles` and [`aws-actions/configure-aws-credentials@v1`](https://github.com/aws-actions/configure-aws-credentials) the policy statement for the static iam user needs to have the actions `\"sts:AssumeRole` AND `sts:TagSession` allowed on the role to assume. The Trust relationship of the assumed role needs to allow those actions for the assuming user. \n\n## Development\n### testing\nTo test the action locally: call `index.js` with the env vars for the action inputs and repo name:\\\n `GITHUB_REPOSITORY=\"shiftcode/my-repo\" INPUT_STACKNAMEPREFIX=\"ch-website\" INPUT_GITHUBTOKEN=\"ghp_xxx\"\" INPUT_IGNORESTACKS=\"[]\" node ./dist/index.js`\n### new version\n1) implement your changes\n2) commit with `npx commit`\n3) set tag `git tag -a -m \"my fancy release\" v0.0.X`\n4) push with tags `git push --follow-tags`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiftcode%2Fdelete-orphan-cfn-stacks-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshiftcode%2Fdelete-orphan-cfn-stacks-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshiftcode%2Fdelete-orphan-cfn-stacks-action/lists"}