From 6524f6b071a456d6ec7ff0eacfd6cefa0370f82c Mon Sep 17 00:00:00 2001 From: Kerry McAdams <58492561+klmcadams@users.noreply.github.com> Date: Wed, 13 Mar 2024 09:43:44 -0400 Subject: [PATCH] feat: add changelog action (#1023) Co-authored-by: pyansys-ci-bot Co-authored-by: Roberto Pastor Muela <37798125+RobPasMue@users.noreply.github.com> Co-authored-by: Kathy Pippert <84872299+PipKat@users.noreply.github.com> --- .github/workflows/label.yml | 16 +++++++++++ CHANGELOG.md | 6 ++++- doc/changelog.d/1023.added.md | 1 + doc/changelog.d/changelog_template.jinja | 15 +++++++++++ pyproject.toml | 34 ++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 doc/changelog.d/1023.added.md create mode 100644 doc/changelog.d/changelog_template.jinja diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 416d5c3314..a0d2bf9b9f 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -1,6 +1,10 @@ name: Labeler on: pull_request: + # opened, reopened, and synchronize are default for pull_request + # edited - when PR title or body is changed + # labeled - when labels are added to PR + types: [opened, reopened, synchronize, edited, labeled] push: branches: [ main ] paths: @@ -83,3 +87,15 @@ jobs: - [good first issue](https://github.com/ansys/pyansys-geometry/pulls?q=label%3Agood+first+issue) - [maintenance](https://github.com/ansys/pyansys-geometry/pulls?q=label%3Amaintenance+) - [release](https://github.com/ansys/pyansys-geometry/pulls?q=label%3Arelease+) + + changelog-fragment: + name: "Create changelog fragment" + needs: [labeler] + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: ansys/actions/doc-changelog@main + with: + token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 505d21df1d..fa641c9236 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,5 @@ -# CHANGELOG \ No newline at end of file +# CHANGELOG + +This project uses [towncrier](https://towncrier.readthedocs.io/) to generate changelogs. You can see the changes for the upcoming release in . + + diff --git a/doc/changelog.d/1023.added.md b/doc/changelog.d/1023.added.md new file mode 100644 index 0000000000..fff154fc36 --- /dev/null +++ b/doc/changelog.d/1023.added.md @@ -0,0 +1 @@ +feat: add changelog action \ No newline at end of file diff --git a/doc/changelog.d/changelog_template.jinja b/doc/changelog.d/changelog_template.jinja new file mode 100644 index 0000000000..0cf429a3b1 --- /dev/null +++ b/doc/changelog.d/changelog_template.jinja @@ -0,0 +1,15 @@ +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} + +### {{ definitions[category]['name'] }} + +{% for text, values in sections[""][category].items() %} +- {{ text }} {{ values|join(', ') }} +{% endfor %} + +{% endfor %} +{% else %} +No significant changes. + + +{% endif %} diff --git a/pyproject.toml b/pyproject.toml index a2abd813c8..e390ea6496 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -129,3 +129,37 @@ show_missing = true minversion = "7.1" addopts = "-ra --cov=ansys.geometry --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv --image_cache_dir tests/integration/image_cache --add_missing_images" testpaths = ["tests"] + +[tool.towncrier] +directory = "doc/changelog.d" +filename = "CHANGELOG.md" +start_string = "\n" +underlines = ["", "", ""] +template = "doc/changelog.d/changelog_template.jinja" +title_format = "## [{version}](https://github.com/ansys/pyansys-geometry/releases/tag/v{version}) - {project_date}" +issue_format = "[#{issue}](https://github.com/ansys/pyansys-geometry/pull/{issue})" + +[[tool.towncrier.type]] +directory = "added" +name = "Added" +showcontent = true + +[[tool.towncrier.type]] +directory = "changed" +name = "Changed" +showcontent = true + +[[tool.towncrier.type]] +directory = "fixed" +name = "Fixed" +showcontent = true + +[[tool.towncrier.type]] +directory = "dependencies" +name = "Dependencies" +showcontent = true + +[[tool.towncrier.type]] +directory = "miscellaneous" +name = "Miscellaneous" +showcontent = true