Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,63 @@ writeLines(pak::pkg_system_requirements("devtools", "ubuntu", "22.04"))
To remove the local virtual Python environment, delete the `r-acro` folder.
On GNU/Linux this is typically located in `~/.virtualenvs`

## Pull Request Titles

Use [Conventional Commits](https://www.conventionalcommits.org) for PR titles (squash-merge messages). This allows automated changelog generation. Common prefixes:

```
feat — new feature
fix — bug fix
docs — documentation changes
style — formatting/styling (no code logic)
refactor — code changes without feature/bug impact
perf — performance improvements
test — adding/updating tests
build — changes to build system or dependencies
ci — changes to CI config/scripts
chore — miscellaneous maintenance tasks
revert — reverts an earlier commit
```

## Release Workflow

`NEWS.md` is generated locally before each release using [git-cliff](https://github.com/orhun/git-cliff). It reads merged PR titles (via squash-merge commit messages) since the last release tag and formats them to match the existing changelog style.

### Install git-cliff

```shell
# pip
pip install git-cliff

# uv
uv tool install git-cliff

# homebrew (macOS / Linux)
brew install git-cliff
```

### Generate the changelog entry

Run the following on `main` immediately before tagging a new release, replacing `X.Y.Z` with the new version:

```shell
git cliff --config cliff.toml --unreleased --tag "VX.Y.Z" --prepend NEWS.md
```

Review and edit `NEWS.md` as needed (e.g. to add extra context or merge duplicate entries), then commit:

```shell
git add NEWS.md
git commit -m "docs: update changelog"
git tag VX.Y.Z
```

The configuration lives in `cliff.toml` at the repository root. It automatically:

- Converts `(#NNN)` PR references into markdown links.
- Skips noise commits (pre-commit auto-fixes, changelog and release-prep commits).
- Filters out commits that do not follow Conventional Commits (see [Pull Request Titles](#pull-request-titles)).

## CRAN Submission

A useful command to run before submitting:
Expand Down
42 changes: 42 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[changelog]
header = ""
body = """
{% if version %}\
# acro {{ version | trim_start_matches(pat="v") }}

{% else %}\
# Unreleased

{% endif %}\
{% for commit in commits -%}
* {% if commit.scope %}{{ commit.group }}({{ commit.scope }}): {% else %}{{ commit.group }}: {% endif %}{{ commit.message | trim }}
{% endfor %}\
"""
trim = true
footer = ""

[git]
conventional_commits = true
filter_unconventional = true
tag_pattern = "V[0-9]+\\.[0-9]+\\.[0-9]+"

commit_preprocessors = [
{ pattern = ' \(#(\d+)\)', replace = ' ([#$1](https://github.com/AI-SDC/ACRO-R/pull/$1))' },
]

commit_parsers = [
{ message = "^\\[pre-commit", skip = true },
{ message = "^docs: update changelog", skip = true },
{ message = "^chore: prepare", skip = true },
{ message = "^feat", group = "feat" },
{ message = "^fix", group = "fix" },
{ message = "^docs", group = "docs" },
{ message = "^chore", group = "chore" },
{ message = "^ci", group = "ci" },
{ message = "^refactor", group = "refactor" },
{ message = "^test", group = "test" },
{ message = "^build", group = "build" },
{ message = "^perf", group = "perf" },
{ message = "^style", group = "style" },
{ message = "^revert", group = "revert" },
]
Loading