Contributing Guide
Thank you for your interest in contributing to my JSON to Variables Setter action! This document provides guidelines and instructions for contributing to this project.
Table of Contents
- Contributing Guide
- Table of Contents
- Code of Conduct
- Getting Started
- Development Workflow
- Coding Guidelines
- Documentation
- Core Components Development
- Release Process
- Feedback
Code of Conduct
Please be respectful to all contributors and users. I aim to foster an inclusive and welcoming community.
Getting Started
Development Environment Setup
-
Clone the repository:
-
Install dependencies:
Option 1: Using uv (recommended)
uv synccreates the virtual environment (.venv) under the project automatically fromuv.lock, so there is no need to manually create one.Option 2: Using pip with requirements files
-
Set up pre-commit hooks:
Optional: faster local hooks with prek
prekis a Rust reimplementation of pre-commit that reads the same.pre-commit-config.yamland runs the hooks faster (parallel execution, quicker hook-environment setup). It is a drop-in for local use only — CI and the required checks still runpre-commit, so adopting it is entirely optional and changes no workflow.If a hook ever behaves differently under prek, fall back to
uv run pre-commit— the configuration is identical.
Project Structure
My project is organized as follows:
Development Workflow
Creating Issues
Before starting any work, please check existing issues or create a new one to discuss the changes you'd like to make.
- For bugs, include steps to reproduce, expected behavior, and actual behavior
- For features, explain the use case and proposed implementation
Making Changes
-
Create a branch:
Branch naming conventions:
Branches must follow the format:<type>-<short-description>.
Use the following prefixes based on the purpose of the branch:feature-<description>: For implementing new features (e.g., feature-newlang-support).bugfix-<description>: For fixing bugs (e.g., bugfix-fetch-python-version-error).docs-<description>: For documentation updates (e.g., docs-update-readme).refactor-<description>: For code refactoring without functional changes (e.g., refactor-cleanup-utils).
-
Make your changes:
- Follow my coding guidelines
- Keep changes focused on a single issue/feature
-
Commit your changes using gitmoji:
Recommended gitmoji conventions:
- ✨ (
:sparkles:) - New feature - 🐛 (
:bug:) - Bug fix - 📝 (
:memo:) - Documentation updates - ♻️ (
:recycle:) - Code refactoring - 🚀 (
:rocket:) - Performance improvements - 🎨 (
:art:) - Code style/structure improvements - 🧪 (
:test_tube:) - Add or update tests
Write clear commit messages that explain what changes were made and why.
Gitmoji drives the release version
Releases are automated with semantic-release-gitmoji, so the gitmoji you choose determines the next version:
- 💥 (
:boom:) → major (breaking change) - ✨ (
:sparkles:) → minor (new feature) - 🐛
:bug:, 🚑:ambulance:, 🔒:lock:, ⚡:zap:, 🔧:wrench:, ♻️:recycle:, ⬆️:arrow_up:, … → patch - Other gitmoji (e.g. 📝
:memo:, 🎨:art:, 🧪:white_check_mark:) do not trigger a release.
The full mapping lives in
releaseRulesin.releaserc.cjs. - ✨ (
Testing Changes
About the Testing Policy
- Test code should be created using pytest
- Coverage must be at least 95% (ideally 100%)
-
Run unit tests (required):
-
Run linters (required):
-
Manual testing:
Test the action by using it in a test workflow with various configurations.
Pull Requests
-
Push your branch:
-
Create a pull request:
- Go to the GitHub repository
- Click "Pull requests" > "New pull request"
- Select your branch
- Fill in the PR template
-
Code review:
- Respond to feedback and make necessary changes
- Keep the PR focused on a single issue/feature
Coding Guidelines
Python code:
- Follow PEP 8 style guide
- Use type hints as defined in my mypy configuration
- Document functions and classes with docstrings
- Keep functions focused on a single responsibility
Linting and Formatting (required)
- My project uses pre-commit hooks for consistent code quality
- All code must pass pre-commit checks before submitting PRs
- Configuration is defined in
.pre-commit-config.yamlandpyproject.toml - Key linting tools:
- Ruff for linting and formatting
- mypy for static type checking
- markdownlint for Markdown files
- actionlint for GitHub Actions workflows
- shellcheck for shell script checking
- validate-pyproject for
pyproject.tomlschema validation - typos for source-code spell checking (config in
[tool.typos])
- You can run all linters at once using:
uv run pre-commit run --all-files
Modern Quality preview (CI, advisory)
- The
modern-quality.ymlworkflow runs an extra, non-blocking quality/security suite on pull requests and onmain(every analysis job iscontinue-on-error; findings appear in the run summary). pre-commit and the test workflows remain the required checks. - Jobs:
validate-pyproject,typos,zizmor(GitHub Actions security audit),ty(Astral fast type checker — mypy stays canonical),pip-audit(dependency CVE scan), andgitleaks(secret scan; CI-only). - All
uses:actions in.github/workflows/**andaction.ymlare pinned to commit SHAs (with the version as a trailing comment) for supply-chain hardening. The exampleuses: 7rikazhexde/json2vars-setter@vX.Y.Zreferences stay as version tags so usage examples track the released version. - The third-party / official action versions shown in the docs and README usage examples (
actions/checkout,actions/setup-python, …) are kept in step with the real workflows bysync_doc_action_refs.py, which treats the SHA-pinned workflows /action.yml(the source of truth Dependabot maintains) as canonical and rewrites the version tag of each matching action in the Markdown examples. It runs as a pre-commit hook (sync-doc-action-refs) on any commit that touches the docs or the workflows, and supports--checkfor CI verification. Dependabot never edits Markdown andsync-version-refs.shonly syncs thejson2vars-setterself-reference, so this script closes that gap. Actions used only in the docs (e.g.dorny/paths-filter) have no source-of-truth version and are left untouched.
Testing (required)
- Write unit tests for all new functionality
- Test edge cases and error conditions
- Maintain or improve test coverage
Documentation
- Update documentation when making changes that affect user-facing functionality
- Follow my existing documentation style
- Include examples for new features
- Update the README.md if necessary
For MkDocs documentation:
-
Test documentation locally:
-
Build documentation:
Core Components Development
When working on my core components, consider the following guidelines:
JSON to GitHub Output Parser (github_output.py)
- Maintain backward compatibility with existing JSON structures
- Ensure proper error handling for malformed JSON
- Optimize for performance with large JSON files
Dynamic Matrix Updater (matrix_update.py)
- Keep the code DRY (Don't Repeat Yourself) when implementing different language fetchers
- Handle API rate limits gracefully
- Implement proper error handling and logging
Version Cache Manager (version_cache.py)
- Ensure thread-safety for file operations
- Optimize disk I/O and API calls
- Maintain backward compatibility with existing cache formats
Release Process
Releases are automated with semantic-release-gitmoji via the semantic-release.yml workflow (manually triggered by a repository administrator). The process involves:
-
Version bumping
- The next version is derived automatically from the gitmoji of the commits since the last release (see "Gitmoji drives the release version" above)
pyproject.tomlanduv.lockare updated, and everyuses: 7rikazhexde/json2vars-setter@vX.Y.Zusage example is synced to the new version
-
Creating a release
CHANGELOG.mdis updated and the version-bump changes are committed back tomain- A tag (format
vX.Y.Z, e.g.v1.3.0) and a GitHub release are created automatically
-
Documentation deployment
- Occurs automatically when changes are merged/pushed to the main branch
- Handled by a dedicated deployment workflow
Feedback
If you have any questions or need help, feel free to:
- Open an issue for discussion
- Contact me directly via X (formerly Twitter) - DMs preferred
Thank you for contributing to my json2vars-setter!