Skip to content
Merged
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
26 changes: 26 additions & 0 deletions template/.github/workflows/check_modified_history.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name : modified_history_check

on :
pull_request:
types:
- opened
- synchronize

jobs:
check-history:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check if HISTORY.rst was modified or created
run: |
git diff origin/${{ github.base_ref }} HEAD \
--diff-filter=AMR \
--name-only \
-- HISTORY.rst | grep -q . || {
echo "ERROR: HISTORY.rst was not modified"
exit 1
}

28 changes: 28 additions & 0 deletions template/HISTORY.rst.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
=======
History
=======

[Unreleased]
------------

Added
^^^^^

Changed
^^^^^^^

Deprecated
^^^^^^^^^^

Removed
^^^^^^^

Fixed
^^^^^

{{ version }} ({{ '%Y-%m-%d' | strftime }})
------------------

Added
^^^^^
* First release on PyPI.
10 changes: 10 additions & 0 deletions tests/test_copier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
from datetime import date

def test_project_folder(default_project):
assert default_project.exit_code == 0
Expand All @@ -13,6 +14,8 @@ def test_project_folder(default_project):
"pyproject.toml",
"my_project/__init__.py",
"my_project/my_project.py",
"HISTORY.rst",
".github/workflows/check_modified_history.yml",
])
def test_generated_file_exists(default_project, file_name):
assert default_project.project_dir.joinpath(file_name).exists()
Expand Down Expand Up @@ -110,3 +113,10 @@ def test_content_project_slug_init(default_project, desired):
content = default_project.project_dir.joinpath('my_project').joinpath(
"__init__.py").read_text()
assert desired in content, f"{desired!r} is not in content"


def test_content_history(default_project):
content = default_project.project_dir.joinpath(
"HISTORY.rst").read_text()
desired = f"0.1.0 ({date.today().strftime('%Y-%m-%d')})"
assert desired in content