|
| 1 | +# Contributing to Terraform Module Releaser |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the **Terraform Module Releaser**! This document provides guidelines and |
| 4 | +information for contributors to help ensure a smooth and effective collaboration experience. |
| 5 | + |
| 6 | +## Table of Contents |
| 7 | + |
| 8 | +- [Getting Started](#getting-started) |
| 9 | +- [Development Environment Setup](#development-environment-setup) |
| 10 | +- [Development Workflow](#development-workflow) |
| 11 | +- [Commit Message Guidelines](#commit-message-guidelines) |
| 12 | +- [Testing](#testing) |
| 13 | +- [Code Style and Linting](#code-style-and-linting) |
| 14 | +- [Pull Request Process](#pull-request-process) |
| 15 | +- [Reporting Issues](#reporting-issues) |
| 16 | +- [Community Guidelines](#community-guidelines) |
| 17 | +- [Release Process](#release-process) |
| 18 | + |
| 19 | +## Getting Started |
| 20 | + |
| 21 | +### Development Containers (Recommended) |
| 22 | + |
| 23 | +This repository includes a pre-configured [development container](https://containers.dev/) that provides the easiest way |
| 24 | +to get started contributing. The devcontainer includes all necessary tools, extensions, and environment variables |
| 25 | +pre-configured. |
| 26 | + |
| 27 | +**Using Visual Studio Code with devcontainers:** |
| 28 | + |
| 29 | +1. Install [Visual Studio Code](https://code.visualstudio.com/) and the |
| 30 | + [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) |
| 31 | +1. Fork and clone the repository |
| 32 | +1. Open the repository in Visual Studio Code |
| 33 | +1. When prompted, click "Reopen in Container" or use `Ctrl+Shift+P` → "Dev Containers: Reopen in Container" |
| 34 | +1. The container will automatically build and install dependencies |
| 35 | + |
| 36 | +**Using GitHub Codespaces:** |
| 37 | + |
| 38 | +1. Fork the repository on GitHub |
| 39 | +1. Click the "Code" button and select "Codespaces" |
| 40 | +1. Create a new codespace - it will automatically use the devcontainer configuration |
| 41 | + |
| 42 | +For more information about development containers, see the |
| 43 | +[official documentation](https://code.visualstudio.com/docs/devcontainers/containers). |
| 44 | + |
| 45 | +### Manual Setup |
| 46 | + |
| 47 | +If you prefer not to use devcontainers, follow these steps: |
| 48 | + |
| 49 | +Before contributing, please: |
| 50 | + |
| 51 | +1. Read the [README.md](./README.md) to understand the project's purpose and functionality |
| 52 | +1. Review the [Security Policy](./SECURITY.md) for security-related guidelines |
| 53 | +1. Check existing [issues](https://github.com/techpivot/terraform-module-releaser/issues) and |
| 54 | + [pull requests](https://github.com/techpivot/terraform-module-releaser/pulls) to avoid duplication |
| 55 | +1. Consider opening an issue first to discuss significant changes or new features |
| 56 | + |
| 57 | +## Development Environment Setup |
| 58 | + |
| 59 | +### Prerequisites |
| 60 | + |
| 61 | +- **Node.js**: Version 20 or higher (see [.node-version](./.node-version) for the exact version) |
| 62 | +- **npm**: Comes with Node.js |
| 63 | +- **Git**: For version control |
| 64 | + |
| 65 | +### Initial Setup |
| 66 | + |
| 67 | +1. **Fork the repository** on GitHub |
| 68 | + |
| 69 | +1. **Clone your fork** locally: |
| 70 | + |
| 71 | + ```bash |
| 72 | + git clone https://github.com/YOUR_USERNAME/terraform-module-releaser.git |
| 73 | + cd terraform-module-releaser |
| 74 | + ``` |
| 75 | + |
| 76 | +1. **Install dependencies**: |
| 77 | + |
| 78 | + ```bash |
| 79 | + npm ci --no-fund |
| 80 | + ``` |
| 81 | + |
| 82 | +1. **Verify the setup** by running tests: |
| 83 | + |
| 84 | + ```bash |
| 85 | + npm run test |
| 86 | + ``` |
| 87 | + |
| 88 | +## Development Workflow |
| 89 | + |
| 90 | +### Making Changes |
| 91 | + |
| 92 | +1. **Create a feature branch** from `main`: |
| 93 | + |
| 94 | + ```bash |
| 95 | + git checkout -b feature/your-feature-name |
| 96 | + ``` |
| 97 | + |
| 98 | +1. **Make your changes** following the coding standards |
| 99 | +1. **Add or update tests** as needed |
| 100 | +1. **Run linting and tests** to ensure quality: |
| 101 | + |
| 102 | + ```bash |
| 103 | + npm run check:fix # Fix linting issues |
| 104 | + npm run test # Run tests |
| 105 | + ``` |
| 106 | + |
| 107 | +1. **Commit your changes** following our commit message guidelines |
| 108 | + |
| 109 | +### Key npm Scripts |
| 110 | + |
| 111 | +- `npm run test` - Run the test suite with coverage |
| 112 | +- `npm run check` - Run code linting and style checks |
| 113 | +- `npm run check:fix` - Automatically fix linting issues where possible |
| 114 | +- `npm run test:watch` - Run tests in watch mode during development |
| 115 | + |
| 116 | +> [!WARNING] Do not check in any build/distribution assets (e.g., outputs from `npm run bundle`). These are handled |
| 117 | +> automatically during the release process. For development and testing, running `npm run test` is sufficient. |
| 118 | +
|
| 119 | +## Commit Message Guidelines |
| 120 | + |
| 121 | +This project uses [Conventional Commits](https://www.conventionalcommits.org/) to automatically determine release types |
| 122 | +and generate changelogs. Please follow the conventional commits specification for all commit messages. |
| 123 | + |
| 124 | +For detailed information about the format, types, and examples, please refer to the |
| 125 | +[Conventional Commits site](https://www.conventionalcommits.org/). |
| 126 | + |
| 127 | +## Testing |
| 128 | + |
| 129 | +### Environment Setup |
| 130 | + |
| 131 | +Before running tests, you need to set up a GitHub Personal Access Token (PAT): |
| 132 | + |
| 133 | +1. **Create a GitHub PAT**: Go to |
| 134 | + [GitHub Settings > Developer settings > Personal access tokens](https://github.com/settings/tokens) |
| 135 | +1. **Generate a new token** with appropriate permissions for repository access |
| 136 | +1. **Export the token** in your terminal: |
| 137 | + |
| 138 | + ```bash |
| 139 | + export GITHUB_TOKEN=your_personal_access_token_here |
| 140 | + ``` |
| 141 | + |
| 142 | +> [!NOTE] If using the devcontainer, the `GITHUB_TOKEN` environment variable is automatically configured from your local |
| 143 | +> environment. |
| 144 | +
|
| 145 | +### Running Tests |
| 146 | + |
| 147 | +```bash |
| 148 | +# Run all tests with coverage |
| 149 | +npm run test |
| 150 | + |
| 151 | +# Run tests in watch mode during development |
| 152 | +npm run test:watch |
| 153 | +``` |
| 154 | + |
| 155 | +### Test Guidelines |
| 156 | + |
| 157 | +- Write tests for all new functionality |
| 158 | +- Ensure existing tests pass |
| 159 | +- Aim for high test coverage |
| 160 | +- Use descriptive test names that explain the expected behavior |
| 161 | +- Follow the existing test patterns in the `__tests__` directory |
| 162 | + |
| 163 | +### Test Types |
| 164 | + |
| 165 | +- **Unit Tests**: Test individual functions and components |
| 166 | +- **Integration Tests**: Test interactions between components |
| 167 | +- **API Tests**: Some tests require `GITHUB_TOKEN` environment variable for real API calls |
| 168 | + |
| 169 | +## Code Style and Linting |
| 170 | + |
| 171 | +This project uses [Biome](https://biomejs.dev/) for linting and code formatting. |
| 172 | + |
| 173 | +### Running Linting |
| 174 | + |
| 175 | +```bash |
| 176 | +# Check for linting issues |
| 177 | +npm run check |
| 178 | + |
| 179 | +# Automatically fix linting issues |
| 180 | +npm run check:fix |
| 181 | +``` |
| 182 | + |
| 183 | +### Style Guidelines |
| 184 | + |
| 185 | +- Follow TypeScript best practices |
| 186 | +- Use meaningful variable and function names |
| 187 | +- Add JSDoc comments for public APIs |
| 188 | +- Keep functions small and focused |
| 189 | +- Use async/await for asynchronous operations |
| 190 | + |
| 191 | +## Pull Request Process |
| 192 | + |
| 193 | +1. **Ensure your branch is up to date** with the main branch: |
| 194 | + |
| 195 | + ```bash |
| 196 | + git checkout main |
| 197 | + git pull upstream main |
| 198 | + git checkout your-branch |
| 199 | + git rebase main |
| 200 | + ``` |
| 201 | + |
| 202 | +1. **Run the full test suite** and ensure everything passes: |
| 203 | + |
| 204 | + ```bash |
| 205 | + npm run test |
| 206 | + ``` |
| 207 | + |
| 208 | +1. **Create a pull request** with: |
| 209 | + - A clear, descriptive title |
| 210 | + - A detailed description of the changes |
| 211 | + - Reference to any related issues |
| 212 | + - Screenshots or examples if applicable |
| 213 | + |
| 214 | +1. **Address review feedback** promptly and respectfully |
| 215 | + |
| 216 | +1. **Ensure CI checks pass** before requesting final review |
| 217 | + |
| 218 | +### Pull Request Guidelines |
| 219 | + |
| 220 | +- Keep pull requests focused and atomic |
| 221 | +- Include tests for new functionality |
| 222 | +- Update documentation as needed |
| 223 | +- Ensure backwards compatibility unless it's a breaking change |
| 224 | +- Follow the conventional commit format for the PR title |
| 225 | + |
| 226 | +## Reporting Issues |
| 227 | + |
| 228 | +### Bug Reports |
| 229 | + |
| 230 | +When reporting bugs, please include: |
| 231 | + |
| 232 | +- **Clear description** of the issue |
| 233 | +- **Steps to reproduce** the problem |
| 234 | +- **Expected vs actual behavior** |
| 235 | +- **Environment details** (Node.js version, OS, etc.) |
| 236 | +- **Relevant logs or error messages** |
| 237 | +- **Minimal reproduction case** if possible |
| 238 | + |
| 239 | +### Feature Requests |
| 240 | + |
| 241 | +For feature requests, please provide: |
| 242 | + |
| 243 | +- **Clear description** of the proposed feature |
| 244 | +- **Use case** and justification |
| 245 | +- **Possible implementation approach** (if you have ideas) |
| 246 | +- **Willingness to contribute** the implementation |
| 247 | + |
| 248 | +### Security Issues |
| 249 | + |
| 250 | +For security-related issues, please follow our [Security Policy](./SECURITY.md) and report them to |
| 251 | +<security@techpivot.com>. |
| 252 | + |
| 253 | +## Community Guidelines |
| 254 | + |
| 255 | +### Code of Conduct |
| 256 | + |
| 257 | +- Be respectful and inclusive |
| 258 | +- Welcome newcomers and help them learn |
| 259 | +- Focus on constructive feedback |
| 260 | +- Assume good intentions |
| 261 | +- Follow the |
| 262 | + [GitHub Community Guidelines](https://docs.github.com/en/site-policy/github-terms/github-community-guidelines) |
| 263 | + |
| 264 | +### Communication |
| 265 | + |
| 266 | +- Use clear, concise language |
| 267 | +- Provide context for your suggestions |
| 268 | +- Be patient with review processes |
| 269 | +- Ask questions if anything is unclear |
| 270 | + |
| 271 | +## Release Process |
| 272 | + |
| 273 | +This project uses automated releases managed by maintainers through GitHub Actions. The release process is handled via |
| 274 | +the |
| 275 | +[Release-Start workflow](https://github.com/techpivot/terraform-module-releaser/actions/workflows/release-start.yml). |
| 276 | + |
| 277 | +### How Releases Work |
| 278 | + |
| 279 | +- **Semantic versioning** based on conventional commits |
| 280 | +- **Automatic changelog generation** from commit messages |
| 281 | +- **GitHub releases** with proper tagging |
| 282 | +- **Automated asset building** via `npm run bundle` during the release process |
| 283 | + |
| 284 | +### Release Workflow |
| 285 | + |
| 286 | +When maintainers are ready to create a release: |
| 287 | + |
| 288 | +1. The Release-Start workflow is triggered |
| 289 | +1. A new pull request is automatically generated that: |
| 290 | + - Builds distribution assets via `npm run bundle` |
| 291 | + - Tags the appropriate version based on conventional commits |
| 292 | + - Generates a changelog automatically |
| 293 | + - Creates the GitHub release |
| 294 | + |
| 295 | +Contributors don't need to manually manage versions, releases, or build assets. The automation handles this based on |
| 296 | +your commit messages and pull request merges. |
| 297 | + |
| 298 | +## Getting Help |
| 299 | + |
| 300 | +If you need help or have questions: |
| 301 | + |
| 302 | +1. Check the [existing documentation](./README.md) |
| 303 | +1. Search [existing issues](https://github.com/techpivot/terraform-module-releaser/issues) |
| 304 | +1. Open a new issue with the `question` label |
| 305 | +1. Review the [demo repository](https://github.com/techpivot/terraform-modules-demo) for examples |
| 306 | + |
| 307 | +## Thank You |
| 308 | + |
| 309 | +Your contributions make this project better for everyone. Whether you're fixing bugs, adding features, improving |
| 310 | +documentation, or helping others, we appreciate your efforts! |
| 311 | + |
| 312 | +--- |
| 313 | + |
| 314 | +_For more information about the project, see the [README.md](./README.md) and explore the |
| 315 | +[demo repository](https://github.com/techpivot/terraform-modules-demo)._ |
0 commit comments