Skip to content

Commit

Permalink
use towncrier to handle changelog entries (#284)
Browse files Browse the repository at this point in the history
* use `towncrier` to handle changelog entries

* add change log entry

* add changelog to docs

* looser grep

* make example more explicit
  • Loading branch information
zacharyburnett committed Aug 30, 2024
1 parent 61ff80a commit 2750cef
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 37 deletions.
6 changes: 5 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ This PR addresses ...

**Checklist**

- [ ] added entry in `CHANGES.rst` (either in `Bug Fixes` or `Changes to API`)
- [ ] for a public change, added a towncrier news fragment in `changes/`: <details><summary>`echo "changed something" > changes/<PR#>.<changetype>.rst`</summary>

- ``changes/<PR#>.apichange.rst``: change to public API
- ``changes/<PR#>.bugfix.rst``: fixes an issue
- ``changes/<PR#>.general.rst``: infrastructure or miscellaneous change
- [ ] updated relevant tests
- [ ] updated relevant documentation
- [ ] updated relevant milestone(s)
Expand Down
32 changes: 19 additions & 13 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
name: Ensure changelog
name: changelog

on:
pull_request:
types: [labeled, unlabeled, opened, synchronize, reopened]
types:
- labeled
- unlabeled
- opened
- synchronize
- reopened

# Only cancel in-progress jobs or runs for the current workflow
# This cancels the already triggered workflows for a specific PR without canceling
# other instances of this workflow (other PRs, scheduled triggers, etc) when something
# within that PR re-triggers this CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ensure_changelog:
name: Verify that a changelog entry exists for this pull request
check:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'no-changelog-entry-needed') }}
runs-on: ubuntu-latest
steps:
- uses: scientific-python/action-check-changelogfile@0.2
env:
CHANGELOG_FILENAME: CHANGES.rst
CHECK_MILESTONE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: 3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: pip install .
- run: pip install towncrier
- run: towncrier check
- run: towncrier build --draft | grep -P '#${{ github.event.number }}'
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ build:
os: ubuntu-22.04
tools:
python: mambaforge-4.10
jobs:
post_install:
- towncrier build --keep

conda:
environment: docs/rtd_environment.yaml
Expand Down
23 changes: 0 additions & 23 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
1.8.1 (unreleased)
==================

General
-------

-

Changes to API
--------------

-

Bug Fixes
---------

-

ramp_fitting
~~~~~~~~~~~~

- Fixed memory leak in C-extension.[#281]

1.8.0 (2024-08-14)
==================

Expand Down
1 change: 1 addition & 0 deletions changes/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions changes/281.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed memory leak in C-extension.
1 change: 1 addition & 0 deletions changes/284.general.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use ``towncrier`` to handle changelog entries
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ Package Documentation
:maxdepth: 1

stcal/package_index.rst
stcal/changes.rst
1 change: 1 addition & 0 deletions docs/rtd_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dependencies:
- pip
- graphviz
- sphinx_rtd_theme>1.2.0
- towncrier
7 changes: 7 additions & 0 deletions docs/stcal/changes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. currentmodule:: stcal

***********
Change Log
***********

.. include:: ../../CHANGES.rst
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,21 @@ archs = [
"auto",
"aarch64",
]

[tool.towncrier]
filename = "CHANGES.rst"
directory = "changes"
package = "stcal"
title_format = "{version} ({project_date})"
ignore = [".gitkeep"]
wrap = true
issue_format = "`#{issue} <https://github.com/spacetelescope/stcal/{issue}>`_"

[tool.towncrier.fragment.apichange]
name = "Changes to API"

[tool.towncrier.fragment.bugfix]
name = "Bug Fixes"

[tool.towncrier.fragment.general]
name = "General"

0 comments on commit 2750cef

Please sign in to comment.