| 1 |
# Contributing |
| 2 |
First off, thank you for considering contributing to Changie. |
| 3 |
|
| 4 |
> If you or your team is interested in adapting Changie but |
| 5 |
> not sure how it works into your processes please post a [discussion] for ideas or tips. |
| 6 |
|
| 7 |
If you are interested in contributing but are stuck getting started post a [discussion] for assistance. |
| 8 |
|
| 9 |
## Find a bug? |
| 10 |
Did you run Changie and see a go panic error? |
| 11 |
Maybe your `CHANGELOG.md` file is empty after running merge. |
| 12 |
|
| 13 |
Head on over to the [issues page](https://github.com/miniscruff/changie/issues) and let us know what you did. |
| 14 |
Follow the 'Bug Report' issue template for a guide. |
| 15 |
|
| 16 |
## Need an additional feature? |
| 17 |
Post a [discussion] to present your idea and use cases. |
| 18 |
If the new feature falls in line with the goals of the project it may be approved and implemented. |
| 19 |
Follow the 'Feature Request' issue template for a guide. |
| 20 |
|
| 21 |
## Making changes |
| 22 |
Before making changes please create an issue to discuss if it is a good fit. |
| 23 |
Besides just adding features or fixing bugs, documentation changes are also very helpful. |
| 24 |
Some ideas are example configurations or a guide on how to use Changie with other tools. |
| 25 |
|
| 26 |
If you do decide to contribute code or documentation you will need the following: |
| 27 |
* [Go](https://golang.org/doc/install): check [go.mod](go.mod) for which version is used. |
| 28 |
* Newer versions should also work |
| 29 |
* [MkDocs](https://www.mkdocs.org/) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/): for documentation |
| 30 |
* If you are creating a python virtual environment, the `venv` directory is part of gitignore. |
| 31 |
* [Golang CI](https://golangci-lint.run/): for linting |
| 32 |
* [goimports](https://pkg.go.dev/golang.org/x/tools/cmd/goimports): for linting |
| 33 |
|
| 34 |
### Fork and create a branch |
| 35 |
If there is an issue you want to propose changes for start by [creating a fork](https://help.github.com/articles/fork-a-repo). |
| 36 |
On your new forked repository create a branch. |
| 37 |
Pick any branch name you like that describes your change, but really anything works. |
| 38 |
|
| 39 |
Now you are ready to start working on your change. |
| 40 |
|
| 41 |
Development commands are listed in the [Makefile](/Makefile) and can be run using make. |
| 42 |
Make without arguments, or the help recipe can be used to list possible commands. |
| 43 |
|
| 44 |
### Get the tests running |
| 45 |
|
| 46 |
```bash |
| 47 |
make test |
| 48 |
``` |
| 49 |
|
| 50 |
Running tests should be possible immediately after cloning with just `go`. |
| 51 |
|
| 52 |
### Viewing the documentation |
| 53 |
```bash |
| 54 |
make docs-serve |
| 55 |
``` |
| 56 |
|
| 57 |
Documentation is generated by [MkDocs](https://www.mkdocs.org/) and [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) |
| 58 |
* CLI help is located in the code on Cobra commands |
| 59 |
* Changelog is symlinked from the root CHANGELOG.md file |
| 60 |
* Configuration documentation is generated from inline comments in the code |
| 61 |
* Help and examples are pulled from static markdown files in the `docs` directory |
| 62 |
|
| 63 |
If you are making changes to cobra command documentation you will have to generate markdown documentation before running mkdocs. |
| 64 |
When making changes to static markdown files mkdocs can reload pages when using the "serve" command. |
| 65 |
|
| 66 |
### Creating a change file |
| 67 |
Changie uses itself to generate the [CHANGELOG](CHANGELOG.md). |
| 68 |
If you are making a change that would effect end users you will need to create a change file. |
| 69 |
Change files are generated by Changie using the "new" command. |
| 70 |
|
| 71 |
If you are not sure your work needs a change file you can ask. |
| 72 |
|
| 73 |
As there may be backwards incompatible changes in development it is recommended you run Changie locally instead of a separate installed version. |
| 74 |
To do this use `go run` on the main file: |
| 75 |
|
| 76 |
`go run main.go new` |
| 77 |
|
| 78 |
Gitlab created a guide for [good changelog entires](https://docs.gitlab.com/ee/development/changelog.html#writing-good-changelog-entries) |
| 79 |
that can be referenced when writing your body message. |
| 80 |
|
| 81 |
Be sure to commit the generated file to your branch as part of your pull request. |
| 82 |
|
| 83 |
### Prepare your pull request |
| 84 |
```bash |
| 85 |
make lint |
| 86 |
``` |
| 87 |
|
| 88 |
## Creating your pull request |
| 89 |
When you are ready to get your work merged into the main repository you can |
| 90 |
[open a pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests). |
| 91 |
|
| 92 |
Some tips to streamline this process: |
| 93 |
* Keep the change small. |
| 94 |
* Start your pull request as a draft for feedback. |
| 95 |
* Run all checks before opening your pull request. |
| 96 |
* Add comments to your pull request if you have questions about implementation details. |
| 97 |
* Link your pull request to the issue it resolves [using GitHub keywords](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword). |
| 98 |
|
| 99 |
A maintainer should review your pull request in a timely manner. |
| 100 |
|
| 101 |
If your work is approved it will be "squash and merged" so feel free to use as many commits as you need. |
| 102 |
|
| 103 |
[discussion]: https://github.com/miniscruff/changie/discussions |