From 7edd3e5c9baf6be77cb79dbbb6f99833880e7f36 Mon Sep 17 00:00:00 2001 From: Alexander Dupuy <33216+dupuy@users.noreply.github.com> Date: Tue, 5 Mar 2024 10:16:11 -0500 Subject: [PATCH] feat(docs): Use git-cliff to generate CHANGELOG.md (#68) The git-cliff configuration is kept in pyproject.toml, but as of this commit, git-cliff does not automatically use that file if cliff.toml is not found. The generated CHANGELOG.md was filtered and hand-edited; future commits should implement automation for filtering. --- CHANGELOG | 1 - CHANGELOG.md | 140 ++++++++++++++++++ pyproject.toml | 114 ++++++++++++++ .../config/vocabularies/Reliabot/accept.txt | 5 + 4 files changed, 259 insertions(+), 1 deletion(-) delete mode 100644 CHANGELOG create mode 100644 CHANGELOG.md diff --git a/CHANGELOG b/CHANGELOG deleted file mode 100644 index 98be754..0000000 --- a/CHANGELOG +++ /dev/null @@ -1 +0,0 @@ -Placeholder for CHANGELOG (or CHANGELOG.md). diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..daae06f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,140 @@ +# Changelog + +This file documents notable changes to Reliabot. + +It uses the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format, +and follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) for +releases. + +## [Unreleased] + +### Details + +#### Added + +- Add gitleaks pre-commit checking by @dupuy in + [#57](https://github.com/dupuy/reliabot/pull/57) +- Add CODEOWNERS by @dupuy in [#55](https://github.com/dupuy/reliabot/pull/55) + +#### Changed + +- Pre-commit hook for tidy numbering & ordering of Markdown reference links by + @dupuy in [#35](https://github.com/dupuy/reliabot/pull/35) +- Add @drdrang as reviewer for tidy-md-refs.py by @dupuy in + [#65](https://github.com/dupuy/reliabot/pull/65) +- Cleanup checks and workflows by @dupuy in + [#60](https://github.com/dupuy/reliabot/pull/60) +- Workflow files by @dupuy in [#59](https://github.com/dupuy/reliabot/pull/59) +- StepSecurity Bot by @step-security-bot in + [#56](https://github.com/dupuy/reliabot/pull/56) +- CodeQL & OpenSSF scorecard + best practices badges by @dupuy in + [#53](https://github.com/dupuy/reliabot/pull/53) +- Create ossf-scorecard.yaml workflow by @dupuy +- Expand CONTRIBUTING.md by @dupuy in + [#23](https://github.com/dupuy/reliabot/pull/23) +- Switch order of poetry lock and poetry check +- Update Google styles for Vale by @dupuy in + [#45](https://github.com/dupuy/reliabot/pull/45) +- Ignore length error on pre-commit.ci auto update by @dupuy in + [#44](https://github.com/dupuy/reliabot/pull/44) +- Replace many pre-commit checks/etc. with ruff by @dupuy in + [#38](https://github.com/dupuy/reliabot/pull/38) + +#### Fixed + +- Codeql.yaml cron string by @dupuy in + [#64](https://github.com/dupuy/reliabot/pull/64) +- Self-test from module wrapper __main__ by @dupuy in + [#47](https://github.com/dupuy/reliabot/pull/47) + +## New Contributors + +- @step-security-bot made their first contribution in + [#56](https://github.com/dupuy/reliabot/pull/56) + +## [0.1.2] - 2024-02-06 + +### Details + +#### Added + +- Add first GH workflow (stale) by @dupuy in + [#13](https://github.com/dupuy/reliabot/pull/13) + +#### Changed + +- Rewrite Makefile for installing tools by @dupuy in + [#42](https://github.com/dupuy/reliabot/pull/42) +- Reformat for CI by @dupuy in [#40](https://github.com/dupuy/reliabot/pull/40) +- Use pre-commit-shfmt downloading hook by @dupuy in + [#36](https://github.com/dupuy/reliabot/pull/36) +- Docs: improve issue templates by @dupuy in + [#34](https://github.com/dupuy/reliabot/pull/34) +- Create Placeholder for CONTRIBUTING.md by @dupuy in + [#33](https://github.com/dupuy/reliabot/pull/33) +- Configure gitlint (for CI as well) by @dupuy in + [#31](https://github.com/dupuy/reliabot/pull/31) +- Improve doctest-cli wrapper by @dupuy in + [#26](https://github.com/dupuy/reliabot/pull/26) +- Explain reliabot options and verify console examples by @dupuy in + [#25](https://github.com/dupuy/reliabot/pull/25) +- Provide better error when ruamel.yaml isn't available by @appills in + [#18](https://github.com/dupuy/reliabot/pull/18) +- Vale configuration with vocabulary accept list by @dupuy in + [#19](https://github.com/dupuy/reliabot/pull/19) + +#### Fixed + +- Apply many improvements suggested by ruff checks by @dupuy in + [#39](https://github.com/dupuy/reliabot/pull/39) +- Better gitlint configuration by @dupuy in + [#32](https://github.com/dupuy/reliabot/pull/32) +- Generate required schedule.interval for updates by @dupuy in + [#22](https://github.com/dupuy/reliabot/pull/22) +- Handle no comments in dependabot.yml by @dupuy in + [#21](https://github.com/dupuy/reliabot/pull/21) +- Provide better warning when re2 isn't available by @dupuy in + [#20](https://github.com/dupuy/reliabot/pull/20) + +## New Contributors + +- @appills made their first contribution in + [#18](https://github.com/dupuy/reliabot/pull/18) + +## [0.1.1] - 2024-01-04 + +### Details + +#### Added + +- Add FAQ section to README.md by @dupuy in + [#3](https://github.com/dupuy/reliabot/pull/3) + +#### Changed + +- v0.1.0 reliabot script by @dupuy + +#### Fixed + +- Ignore dotfiles for terraform by @dupuy in + [#11](https://github.com/dupuy/reliabot/pull/11) +- Refactor to use Exclusions for kept folders too by @dupuy in + [#10](https://github.com/dupuy/reliabot/pull/10) +- Don't use re2 for configuration file patterns by @dupuy +- Correctly remove dependabot configurations and truncate by @dupuy +- Resolve PyCharm warnings by @dupuy +- Handle no argument passed to main by @dupuy +- Repair buggy fixes by @dupuy in + [#9](https://github.com/dupuy/reliabot/pull/9) +- Ignore dotfiles like .tflint.hcl by @dupuy in + [#7](https://github.com/dupuy/reliabot/pull/7) +- Resolve TypeError: main() missing … 'argv' by @dupuy in + [#6](https://github.com/dupuy/reliabot/pull/6) +- Fallback to re if re2 not present by @dupuy in + [#2](https://github.com/dupuy/reliabot/pull/2) + + + +[0.1.1]: https://github.com/dupuy/reliabot/compare/v0.1.0..v0.1.1 +[0.1.2]: https://github.com/dupuy/reliabot/compare/v0.1.1..v0.1.2 +[unreleased]: https://github.com/dupuy/reliabot/compare/v0.1.2..HEAD diff --git a/pyproject.toml b/pyproject.toml index 58ea257..18d3786 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,6 +5,120 @@ build-backend = "poetry.core.masonry.api" [tool.bandit] skips = ["B404", "B603"] +# git-cliff ~ https://git-cliff.org/docs/configuration +# with pyproject.toml embedding https://git-cliff.org/docs/integration/python/ +[tool.git-cliff.remote.github] +owner = "dupuy" +repo = "reliabot" +# token = "" + +[tool.git-cliff.changelog] + +# changelog header +header = """ +# Changelog\n +This file documents notable changes to Reliabot.\n +It uses the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format, +and follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html) for +releases.\n +""" + +# template for the changelog body +# https://keats.github.io/tera/docs/#introduction +body = """ +{%- macro remote_url() -%} + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} +{%- endmacro -%} + +{% if version -%} + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else -%} + ## [Unreleased] +{% endif -%} + +### Details\n +{% for group, commits in commits | group_by(attribute="group") %} + #### {{ group | upper_first }} + {%- for commit in commits %} + - {{ commit.message | upper_first | trim }}\ + {% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%} + {% if commit.github.pr_number %} in \ + [#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \ + {%- endif -%} + {% endfor %} +{% endfor %} + +{%- if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %} + ## New Contributors\n +{%- endif -%} + +{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %} + * @{{ contributor.username }} made their first contribution + {%- if contributor.pr_number %} in \ + [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \ + {%- endif %} +{%- endfor %}\n +""" + +# template for the changelog footer (release diff reference links) +footer = """ +{%- macro remote_url() -%} + https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }} +{%- endmacro -%} + +{% for release in releases -%} + {% if release.version -%} + {% if release.previous.version -%} + [{{ release.version | trim_start_matches(pat="v") }}]: \ + {{ self::remote_url() }}/compare/{{ release.previous.version }}..{{ release.version }} + {% endif -%} + {% else -%} + [unreleased]: {{ self::remote_url() }}/compare/{{ release.previous.version }}..HEAD + {% endif -%} +{% endfor %} + +""" +# remove the leading and trailing whitespace from the templates +trim = true + +[tool.git-cliff.git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# process each line of a commit as an individual commit +split_commits = true +# regex for preprocessing the commit messages +commit_preprocessors = [ + # remove issue numbers from commits + { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" }, +] +# regex for parsing and grouping commits +commit_parsers = [ + { message = "^.*: add", group = "Added" }, + { message = "^.*: support", group = "Added" }, + { message = "^.*: remove", group = "Removed" }, + { message = "^.*: delete", group = "Removed" }, + { message = "^test", group = "Fixed" }, + { message = "^fix", group = "Fixed" }, + { message = "^.*: fix", group = "Fixed" }, + { message = "^.*", group = "Changed" }, +] +# protect breaking changes from being skipped due to matching a skipping commit_parser +protect_breaking_commits = false +# filter out the commits that are not matched by commit parsers +filter_commits = false +# regex for matching git tags +tag_pattern = "v[0-9].*" +# regex for skipping tags +skip_tags = "beta|alpha" +# regex for ignoring tags +ignore_tags = "-rc" +# sort the tags topologically +topo_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "newest" + [tool.poetry] name = "reliabot" version = "0.2.0" diff --git a/styles/config/vocabularies/Reliabot/accept.txt b/styles/config/vocabularies/Reliabot/accept.txt index 03469f8..06f8abe 100644 --- a/styles/config/vocabularies/Reliabot/accept.txt +++ b/styles/config/vocabularies/Reliabot/accept.txt @@ -9,10 +9,15 @@ Quis TOML [Dd]ependabot [Rr]eliabot +argv commitizen +cron docstring doctest +dotfiles formatters +gitleaks +gitlint ipsos markdownlint mdformat