|
| 1 | +# Contributing to send-cdevents |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the send-cdevents GitHub Action! |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +This project uses [mise](https://mise.jdx.dev/) for tool management and task automation. |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +1. Install [mise](https://mise.jdx.dev/getting-started.html) |
| 12 | +2. Clone the repository |
| 13 | +3. Install tools and dependencies: |
| 14 | + |
| 15 | +```bash |
| 16 | +mise install |
| 17 | +``` |
| 18 | + |
| 19 | +This will automatically install: |
| 20 | +- `dprint` - for code formatting |
| 21 | +- `bun` - for JavaScript tooling |
| 22 | +- `github-cli` - for GitHub operations |
| 23 | + |
| 24 | +## Development Workflow |
| 25 | + |
| 26 | +### Code Quality Checks |
| 27 | + |
| 28 | +Before submitting any changes, ensure your code passes all quality checks: |
| 29 | + |
| 30 | +```bash |
| 31 | +# Format code |
| 32 | +mise run format |
| 33 | + |
| 34 | +# Run all checks (formatting, validation, linting) |
| 35 | +mise run check |
| 36 | +``` |
| 37 | + |
| 38 | +The `check` task runs: |
| 39 | +- `dprint check` - validates code formatting |
| 40 | +- `bunx @action-validator/core action.yml` - validates GitHub Action schema |
| 41 | + |
| 42 | +### Testing Changes |
| 43 | + |
| 44 | +Test your changes using the test workflow: |
| 45 | + |
| 46 | +```bash |
| 47 | +# Push changes to trigger test workflow |
| 48 | +git push origin feature-branch |
| 49 | + |
| 50 | +# Or run tests manually via GitHub UI: |
| 51 | +# Actions → Test Send CDEvents Action → Run workflow |
| 52 | +``` |
| 53 | + |
| 54 | +The test workflow validates: |
| 55 | +- Basic CDEvent sending |
| 56 | +- HTTP endpoint integration |
| 57 | +- Custom headers |
| 58 | +- Configuration files |
| 59 | +- Environment variables |
| 60 | +- File input |
| 61 | +- Error handling |
| 62 | +- Config cleanup |
| 63 | + |
| 64 | +## Making Changes |
| 65 | + |
| 66 | +### Code Style |
| 67 | + |
| 68 | +- Use consistent formatting (enforced by dprint) |
| 69 | +- Follow existing patterns in the codebase |
| 70 | +- Use proper CDEvents format (see conformance examples) |
| 71 | +- Use multiline YAML strings (`|`) for JSON data in examples |
| 72 | + |
| 73 | +### Documentation |
| 74 | + |
| 75 | +- Update README.md if you change functionality |
| 76 | +- Use proper CDEvent examples from the conformance spec |
| 77 | +- Include GitHub-flavored markdown callouts where helpful |
| 78 | +- Update this CONTRIBUTING.md if you change the development process |
| 79 | + |
| 80 | +### Commit Messages |
| 81 | + |
| 82 | +Use conventional commit format: |
| 83 | +``` |
| 84 | +type: description |
| 85 | +
|
| 86 | +Examples: |
| 87 | +feat: add support for custom timeout configuration |
| 88 | +fix: resolve config file permission issues |
| 89 | +docs: update README with new environment variables |
| 90 | +ci: improve test workflow performance |
| 91 | +``` |
| 92 | + |
| 93 | +## Release Process |
| 94 | + |
| 95 | +### Preferred: GitHub Workflow (Recommended) |
| 96 | + |
| 97 | +1. Ensure all changes are merged to `main` |
| 98 | +2. Go to **Actions** → **Release** → **Run workflow** |
| 99 | +3. Enter the version (e.g., `v1.2.3`) following [semantic versioning](https://semver.org/) |
| 100 | +4. Click **Run workflow** |
| 101 | + |
| 102 | +The workflow will: |
| 103 | +- Run all quality checks |
| 104 | +- Create and push version tag |
| 105 | +- Create GitHub release with usage examples |
| 106 | +- Update major version tag (e.g., `v1`) for GitHub Marketplace |
| 107 | + |
| 108 | +### Alternative: Local Release |
| 109 | + |
| 110 | +If you have the necessary permissions and tools set up locally: |
| 111 | + |
| 112 | +```bash |
| 113 | +# Check release status first |
| 114 | +mise run release-check |
| 115 | + |
| 116 | +# Create release |
| 117 | +mise run release -- v1.2.3 |
| 118 | +``` |
| 119 | + |
| 120 | +> **⚠️ Note**: Local releases require: |
| 121 | +> - Write access to the repository |
| 122 | +> - GitHub CLI authenticated (`gh auth login`) |
| 123 | +> - Clean working directory on `main` branch |
| 124 | +
|
| 125 | +### Version Guidelines |
| 126 | + |
| 127 | +Follow [semantic versioning](https://semver.org/): |
| 128 | + |
| 129 | +- **Patch** (`v1.0.1`): Bug fixes, documentation updates |
| 130 | +- **Minor** (`v1.1.0`): New features, backward-compatible changes |
| 131 | +- **Major** (`v2.0.0`): Breaking changes, incompatible API changes |
| 132 | + |
| 133 | +### Release Checklist |
| 134 | + |
| 135 | +- [ ] All tests pass |
| 136 | +- [ ] Documentation is updated |
| 137 | +- [ ] CHANGELOG.md is updated (if exists) |
| 138 | +- [ ] Version follows semantic versioning |
| 139 | +- [ ] Release notes are meaningful |
| 140 | + |
| 141 | +## Project Structure |
| 142 | + |
| 143 | +``` |
| 144 | +. |
| 145 | +├── action.yml # GitHub Action definition |
| 146 | +├── README.md # User documentation |
| 147 | +├── CONTRIBUTING.md # This file |
| 148 | +├── .mise.toml # Tool management and tasks |
| 149 | +├── dprint.json # Code formatting configuration |
| 150 | +├── .github/ |
| 151 | +│ ├── workflows/ |
| 152 | +│ │ ├── ci.yml # Code quality checks |
| 153 | +│ │ ├── test.yml # Action functionality tests |
| 154 | +│ │ └── release.yml # Release automation |
| 155 | +│ ├── dependabot.yml # Dependency updates |
| 156 | +│ └── markdownlint.json # Markdown linting config |
| 157 | +└── test-data/ # Sample CDEvent files |
| 158 | +``` |
| 159 | + |
| 160 | +## Available Tasks |
| 161 | + |
| 162 | +```bash |
| 163 | +# Show all available tasks |
| 164 | +mise tasks |
| 165 | + |
| 166 | +# Key tasks: |
| 167 | +mise run format # Format all code |
| 168 | +mise run check # Run all quality checks |
| 169 | +mise run release-check # Check current release status |
| 170 | +mise run release -- v1.2.3 # Create new release |
| 171 | +``` |
| 172 | + |
| 173 | +## Getting Help |
| 174 | + |
| 175 | +- Check existing [Issues](https://github.com/cdviz-dev/send-cdevents/issues) |
| 176 | +- Review the [cdviz-collector documentation](https://github.com/cdviz-dev/cdviz-collector) |
| 177 | +- Look at [CDEvents specification](https://cdevents.dev/) |
| 178 | +- Open a new issue for bugs or feature requests |
| 179 | + |
| 180 | +## Code of Conduct |
| 181 | + |
| 182 | +This project follows the [Contributor Covenant Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). By participating, you agree to uphold this code. |
| 183 | + |
| 184 | +Thank you for contributing! 🎉 |
0 commit comments