{"id":49541313,"url":"https://github.com/subhamay-bhattacharyya-trash/cfn-stack-params-action","last_synced_at":"2026-05-02T15:07:56.042Z","repository":{"id":305564988,"uuid":"1023069831","full_name":"subhamay-bhattacharyya-trash/cfn-stack-params-action","owner":"subhamay-bhattacharyya-trash","description":"✅ ⭐️ GitHub JavaScript Action - Prepare CloudFormation Stack Creation Parameters","archived":false,"fork":false,"pushed_at":"2026-02-02T04:15:00.000Z","size":285,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-12T11:37:31.176Z","etag":null,"topics":["chatgpt","cloudformation","devspace-hackathon","github-action","github-codespace","github-copilot","kiro-dev","openai","semantic-release-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/subhamay-bhattacharyya-trash.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-20T13:14:19.000Z","updated_at":"2025-07-29T11:54:00.000Z","dependencies_parsed_at":"2025-08-06T17:05:56.087Z","dependency_job_id":"a79c32bc-e6dd-4169-8d43-4d7d88b9d927","html_url":"https://github.com/subhamay-bhattacharyya-trash/cfn-stack-params-action","commit_stats":null,"previous_names":["subhamay-bhattacharyya-gha/cfn-stack-params-action"],"tags_count":4,"template":false,"template_full_name":"subhamay-bhattacharyya-gha/github-action-template","purl":"pkg:github/subhamay-bhattacharyya-trash/cfn-stack-params-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subhamay-bhattacharyya-trash%2Fcfn-stack-params-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subhamay-bhattacharyya-trash%2Fcfn-stack-params-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subhamay-bhattacharyya-trash%2Fcfn-stack-params-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subhamay-bhattacharyya-trash%2Fcfn-stack-params-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/subhamay-bhattacharyya-trash","download_url":"https://codeload.github.com/subhamay-bhattacharyya-trash/cfn-stack-params-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/subhamay-bhattacharyya-trash%2Fcfn-stack-params-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32538329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T12:25:33.646Z","status":"ssl_error","status_checked_at":"2026-05-02T12:24:51.733Z","response_time":132,"last_error":"SSL_read: 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":["chatgpt","cloudformation","devspace-hackathon","github-action","github-codespace","github-copilot","kiro-dev","openai","semantic-release-plugin"],"created_at":"2026-05-02T15:07:55.924Z","updated_at":"2026-05-02T15:07:56.035Z","avatar_url":"https://github.com/subhamay-bhattacharyya-trash.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CloudFormation Configuration Processor Action\n\n![Built with Kiro](https://img.shields.io/badge/Built%20with-Kiro-blue?style=flat\u0026logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMCA5TDEzLjA5IDE1Ljc0TDEyIDIyTDEwLjkxIDE1Ljc0TDQgOUwxMC45MSA4LjI2TDEyIDJaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K)\u0026nbsp;![GitHub Action](https://img.shields.io/badge/GitHub-Action-blue?logo=github)\u0026nbsp;![Release](https://github.com/subhamay-bhattacharyya-gha/cfn-stack-params-action/actions/workflows/release.yaml/badge.svg)\u0026nbsp;![Commit Activity](https://img.shields.io/github/commit-activity/t/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![Bash](https://img.shields.io/badge/Language-Bash-green?logo=gnubash)\u0026nbsp;![CloudFormation](https://img.shields.io/badge/AWS-CloudFormation-orange?logo=amazonaws)\u0026nbsp;![Last Commit](https://img.shields.io/github/last-commit/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![Release Date](https://img.shields.io/github/release-date/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![Repo Size](https://img.shields.io/github/repo-size/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![File Count](https://img.shields.io/github/directory-file-count/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![Issues](https://img.shields.io/github/issues/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![Top Language](https://img.shields.io/github/languages/top/subhamay-bhattacharyya-gha/cfn-stack-params-action)\u0026nbsp;![Custom Endpoint](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/bsubhamay/4b247fb46db91d8488e878ac1b4d3920/raw/cfn-stack-params-action.json?)\n\n\nA GitHub Action that processes CloudFormation deployment configurations, merges parameter files with environment-specific overrides, and generates outputs for CloudFormation stack deployment including parameter arrays, stack names, and CI build identifiers.\n\n## Features\n\n- 📁 **Flexible Configuration**: Reads CloudFormation configurations from customizable folder structures\n- 🔄 **Parameter Merging**: Automatically merges default parameters with environment-specific overrides\n- 🏷️ **Dynamic Stack Naming**: Generates appropriate stack names for both CI builds and environment deployments\n- 🎲 **CI Build Identifiers**: Creates unique identifiers for CI builds to enable parallel deployments\n- ✅ **Comprehensive Validation**: Validates JSON files and required fields with clear error messages\n- 🧪 **Well Tested**: Extensive unit and integration test coverage\n\n## Quick Start\n\n```yaml\n- name: Process CloudFormation Configuration\n  uses: subhamay-bhattacharyya-gha/cfn-stack-params-action@main\n  with:\n    cfn-directory: 'infrastructure'\n    ci-build: 'false'\n    environment: 'sb-prod-us-east-1'\n  id: cfn-config\n\n- name: Deploy CloudFormation Stack\n  uses: subhamay-bhattacharyya/cfn-create-stack-action@main\n  with:\n    name: ${{ steps.cfn-config.outputs.stack-name }}\n    template: infrastructure/template.yaml\n    parameter-overrides: ${{ steps.cfn-config.outputs.parameters }}\n```\n\n## Table of Contents\n\n- [Inputs](#inputs)\n- [Outputs](#outputs)\n- [Configuration Structure](#configuration-structure)\n- [Usage Examples](#usage-examples)\n- [Error Scenarios](#error-scenarios)\n- [Troubleshooting](#troubleshooting)\n- [Workflow Examples](docs/WORKFLOW_EXAMPLES.md)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Inputs\n\n| Name | Description | Required | Default | Example |\n|------|-------------|----------|---------|---------|\n| `cfn-directory` | Folder containing CloudFormation configuration files | No | `cfn` | `infrastructure` |\n| `ci-build` | Whether this is a CI build (true/false) | No | `false` | `true` |\n| `environment` | Target environment name | No | `''` | `sb-prod-us-east-1` |\n\n### Input Details\n\n#### `cfn-directory`\nSpecifies the folder path (relative to repository root) containing your CloudFormation configuration files. The folder must contain:\n- `cloudformation.json` - Main configuration file\n- `params/` - Subfolder with parameter files\n\n#### `ci-build`\nBoolean flag that determines the stack naming strategy:\n- `true`: Uses current Git branch name in stack name (for feature branch deployments)\n- `false`: Uses environment name in stack name (for environment deployments)\n\n#### `environment`\nEnvironment identifier used for:\n- Loading environment-specific parameter files (`params/{environment}.json`)\n- Stack naming when `ci-build` is `false`\n\n## Outputs\n\n| Name | Description | Type | Example |\n|------|-------------|------|---------|\n| `parameters` | CloudFormation parameters in JSON array format | String | `[{\"ParameterName\":\"VpcId\",\"ParameterValue\":\"vpc-123\"}]` |\n| `stack-name` | Generated CloudFormation stack name | String | `myproject-api-sb-prod-us-east-1` |\n| `ci-build-id` | CI build identifier (random string for CI builds, empty otherwise) | String | `abcdefgh` |\n\n### Output Details\n\n#### `parameters`\nJSON string containing an array of CloudFormation parameters in the format:\n```json\n[\n  {\n    \"ParameterName\": \"ParameterKey\",\n    \"ParameterValue\": \"ParameterValue\"\n  }\n]\n```\n\n#### `stack-name`\nGenerated stack name following these patterns:\n- **CI Build**: `{project}-{stack-prefix}-{sanitized-branch-name}`\n- **Environment**: `{project}-{stack-prefix}-{environment}`\n\n#### `ci-build-id`\n- **CI Build**: Random 6-10 character lowercase string (e.g., `abcdefgh`)\n- **Environment**: Empty string\n\n## Configuration Structure\n\nYour CloudFormation configuration should follow this directory structure:\n\n```\n{cfn-directory}/\n├── cloudformation.json          # Main configuration\n└── params/\n    ├── default.json            # Default parameters (required)\n    ├── sb-devl-us-east-1.json  # Environment-specific parameters\n    ├── sb-test-us-east-1.json  # Environment-specific parameters\n    └── sb-prod-us-east-1.json  # Environment-specific parameters\n```\n\n### cloudformation.json\n\nMain configuration file with required fields:\n\n```json\n{\n  \"project\": \"my-application\",\n  \"template\": \"infrastructure.yaml\",\n  \"stack-prefix\": \"api\"\n}\n```\n\n| Field | Description | Required | Example |\n|-------|-------------|----------|---------|\n| `project` | Project identifier used in stack naming | Yes | `my-application` |\n| `template` | CloudFormation template filename | Yes | `infrastructure.yaml` |\n| `stack-prefix` | Stack prefix used in stack naming | Yes | `api` |\n\n### Parameter Files\n\n#### default.json (Required)\nContains default parameter values that apply to all environments:\n\n```json\n{\n  \"VpcId\": \"vpc-default\",\n  \"InstanceType\": \"t3.micro\",\n  \"Environment\": \"default\",\n  \"EnableLogging\": true,\n  \"BackupRetention\": 7\n}\n```\n\n#### {environment}.json (Optional)\nEnvironment-specific parameters that override defaults:\n\n```json\n{\n  \"VpcId\": \"vpc-prod-123456\",\n  \"InstanceType\": \"t3.large\",\n  \"Environment\": \"sb-prod-us-east-1\",\n  \"BackupRetention\": 30,\n  \"AlarmEmail\": \"alerts@company.com\"\n}\n```\n\n**Parameter Merging Rules:**\n1. Default parameters are loaded first\n2. Environment-specific parameters override matching keys\n3. Environment-specific parameters can add new keys\n4. Final output contains merged parameters in CloudFormation format\n\n## Usage Examples\n\n### Basic Environment Deployment\n\n```yaml\nname: Deploy to Production\n\non:\n  push:\n    branches: [main]\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      \n      - name: Process CloudFormation Configuration\n        uses: subhamay-bhattacharyya-gha/cfn-stack-params-action@main\n        with:\n          cfn-directory: 'infrastructure'\n          ci-build: 'false'\n          environment: 'sb-prod-us-east-1'\n        id: cfn-config\n      \n      - name: Deploy Stack\n        run: |\n          aws cloudformation deploy \\\n            --stack-name ${{ steps.cfn-config.outputs.stack-name }} \\\n            --template-file infrastructure/template.yaml \\\n            --parameter-overrides '${{ steps.cfn-config.outputs.parameters }}'\n```\n\n### CI Build with Feature Branch\n\n```yaml\nname: Feature Branch Deployment\n\non:\n  pull_request:\n    branches: [main]\n\njobs:\n  deploy-feature:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      \n      - name: Process CloudFormation Configuration\n        uses: subhamay-bhattacharyya-gha/cfn-stack-params-action@main\n        with:\n          cfn-directory: 'cfn'\n          ci-build: 'true'\n          environment: 'sb-devl-us-east-1'\n        id: cfn-config\n      \n      - name: Deploy Feature Stack\n        run: |\n          echo \"Stack Name: ${{ steps.cfn-config.outputs.stack-name }}\"\n          echo \"CI Build ID: ${{ steps.cfn-config.outputs.ci-build-id }}\"\n          echo \"Parameters: ${{ steps.cfn-config.outputs.parameters }}\"\n```\n\n### Multi-Environment Matrix Deployment\n\n```yaml\nname: Multi-Environment Deployment\n\non:\n  workflow_dispatch:\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        environment: \n          - sb-devl-us-east-1\n          - sb-test-us-east-1\n          - sb-prod-us-east-1\n    \n    steps:\n      - uses: actions/checkout@v4\n      \n      - name: Process CloudFormation Configuration\n        uses: subhamay-bhattacharyya-gha/cfn-stack-params-action@main\n        with:\n          cfn-directory: 'infrastructure'\n          ci-build: 'false'\n          environment: ${{ matrix.environment }}\n        id: cfn-config\n      \n      - name: Deploy to ${{ matrix.environment }}\n        run: |\n          aws cloudformation deploy \\\n            --stack-name ${{ steps.cfn-config.outputs.stack-name }} \\\n            --template-file infrastructure/template.yaml \\\n            --parameter-overrides '${{ steps.cfn-config.outputs.parameters }}'\n```\n\n### Custom Configuration Directory\n\n```yaml\n- name: Process CloudFormation Configuration\n  uses: subhamay-bhattacharyya-gha/cfn-stack-params-action@main\n  with:\n    cfn-directory: 'aws/cloudformation'\n    ci-build: 'false'\n    environment: 'production'\n  id: cfn-config\n```\n\n## Error Scenarios\n\nThe action provides clear error messages for common issues:\n\n### Missing Configuration Files\n\n**Error**: Configuration directory not found\n```\nError: Configuration directory 'cfn' does not exist\n```\n\n**Error**: Missing cloudformation.json\n```\nError: cloudformation.json not found in cfn directory\n```\n\n**Error**: Missing default parameters\n```\nError: default.json not found in cfn/params directory\n```\n\n### Invalid JSON Format\n\n**Error**: Malformed JSON\n```\nError: Invalid JSON in cloudformation.json: Unexpected token } in JSON at position 45\n```\n\n**Error**: Missing required fields\n```\nError: Missing required field 'project' in cloudformation.json\n```\n\n### Git Operation Errors (CI Build Mode)\n\n**Error**: Unable to determine branch\n```\nError: Unable to determine current branch name for CI build\n```\n\n**Error**: Not a Git repository\n```\nError: Current directory is not a Git repository\n```\n\n### Parameter File Issues\n\n**Warning**: Missing environment parameters (non-fatal)\n```\nWarning: Environment parameter file 'sb-test-us-east-1.json' not found, using default parameters only\n```\n\n**Error**: Invalid parameter JSON\n```\nError: Invalid JSON in params/default.json: Unexpected token ] in JSON at position 23\n```\n\n## Troubleshooting\n\n### Common Issues and Solutions\n\n#### Issue: \"Configuration directory does not exist\"\n\n**Cause**: The specified `cfn-directory` path doesn't exist in your repository.\n\n**Solutions**:\n1. Verify the directory path is correct relative to repository root\n2. Ensure the directory is committed to your repository\n3. Check for typos in the `cfn-directory` input\n\n```yaml\n# Correct\ncfn-directory: 'infrastructure'  # Directory exists at repo root\n\n# Incorrect\ncfn-directory: 'infrastucture'   # Typo in directory name\n```\n\n#### Issue: \"Missing required field in cloudformation.json\"\n\n**Cause**: The `cloudformation.json` file is missing required fields.\n\n**Solution**: Ensure your `cloudformation.json` contains all required fields:\n\n```json\n{\n  \"project\": \"your-project-name\",      // Required\n  \"template\": \"template.yaml\",         // Required  \n  \"stack-prefix\": \"api\"               // Required\n}\n```\n\n#### Issue: \"Unable to determine current branch name for CI build\"\n\n**Cause**: Git operations failed when `ci-build` is set to `true`.\n\n**Solutions**:\n1. Ensure you're using `actions/checkout@v4` before this action\n2. Verify the repository has Git history\n3. Check that the workflow has proper Git access\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4  # Required for Git operations\n  - name: Process CloudFormation Configuration\n    uses: subhamay-bhattacharyya-gha/cfn-stack-params-action@main\n    with:\n      ci-build: 'true'\n```\n\n#### Issue: Parameters not merging correctly\n\n**Cause**: Parameter files have incorrect structure or naming.\n\n**Solutions**:\n1. Verify `default.json` exists in the `params/` subdirectory\n2. Ensure environment parameter files are named exactly `{environment}.json`\n3. Check that all JSON files have valid syntax\n\n```\ncfn/\n├── cloudformation.json\n└── params/\n    ├── default.json                    ✅ Correct\n    ├── sb-prod-us-east-1.json         ✅ Correct\n    ├── prod.json                      ❌ Won't match environment 'sb-prod-us-east-1'\n    └── sb-prod-us-east-1.JSON         ❌ Wrong file extension case\n```\n\n#### Issue: Stack name contains invalid characters\n\n**Cause**: Branch names or environment names contain characters not allowed in CloudFormation stack names.\n\n**Solution**: The action automatically sanitizes branch names, but ensure environment names follow CloudFormation naming rules:\n- Only alphanumeric characters and hyphens\n- Must start with a letter\n- Maximum 128 characters\n\n#### Issue: Action fails with permission errors\n\n**Cause**: Insufficient permissions to read files or execute Git commands.\n\n**Solutions**:\n1. Ensure the workflow has proper repository permissions\n2. Check that files are not in `.gitignore`\n3. Verify file permissions in the repository\n\n### Debug Mode\n\nEnable debug logging by setting the `ACTIONS_STEP_DEBUG` secret to `true` in your repository settings. This will provide detailed logs of the action's execution.\n\n### Getting Help\n\nFor detailed troubleshooting information, see the [Troubleshooting Guide](TROUBLESHOOTING.md).\n\nIf you encounter issues not covered in the guides:\n\n1. Check the [Issues](https://github.com/subhamay-bhattacharyya-gha/cfn-stack-params-action/issues) page for similar problems\n2. Review the action logs for detailed error messages\n3. Ensure your configuration follows the documented structure\n4. Test your JSON files with a JSON validator\n\n## Best Practices\n\n### Security Considerations\n\nWhen using this action in production environments:\n\n- **Parameter Encryption**: Store sensitive parameters in AWS Systems Manager Parameter Store or AWS Secrets Manager\n- **IAM Permissions**: Use least-privilege IAM roles for CloudFormation deployments\n- **Environment Isolation**: Keep environment-specific configurations in separate branches or repositories\n- **Secrets Management**: Never commit sensitive values to parameter files\n\n### Performance Optimization\n\n- **Parameter File Size**: Keep parameter files small and focused to reduce processing time\n- **CI Build Strategy**: Use `ci-build: true` for feature branches to enable parallel deployments\n- **Caching**: Consider caching CloudFormation configuration files in multi-step workflows\n\n### Monitoring and Logging\n\n- **Stack Drift Detection**: Regularly check for configuration drift between your parameter files and deployed stacks\n- **Deployment Tracking**: Use the generated `ci-build-id` for correlating logs across deployment steps\n- **Error Handling**: Implement proper error handling in your workflows to catch configuration issues early\n\n## Migration Guide\n\n### From v1.0.x to v1.1.x\n\nThis action maintains backward compatibility. No changes required for existing workflows.\n\n### Upgrading from Custom Scripts\n\nIf you're migrating from custom parameter processing scripts:\n\n1. **Create Configuration Structure**: Set up the required `cloudformation.json` and `params/` directory\n2. **Update Workflow**: Replace custom scripts with this action\n3. **Test Environment Mapping**: Verify environment parameter files are correctly named\n4. **Validate Outputs**: Ensure the generated parameters work with your CloudFormation deployment actions\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n### Development Setup\n\n1. Clone the repository\n2. Install dependencies: `npm install`\n3. Run tests: `npm test`\n4. Run linting: `npm run lint`\n\n### Running Tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run unit tests only\nnpm run test:unit\n\n# Run integration tests only\nnpm run test:integration\n\n# Run with coverage\nnpm run test:coverage\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubhamay-bhattacharyya-trash%2Fcfn-stack-params-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubhamay-bhattacharyya-trash%2Fcfn-stack-params-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubhamay-bhattacharyya-trash%2Fcfn-stack-params-action/lists"}