Skip to content

Commit ba7be65

Browse files
add nox task for checking if the changelog got updated
1 parent 818dc22 commit ba7be65

File tree

4 files changed

+57
-0
lines changed

4 files changed

+57
-0
lines changed

.github/workflows/checks.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ jobs:
4040
run: |
4141
poetry run python -m nox -s docs:build
4242
43+
Changelog:
44+
name: Changelog Update Check
45+
runs-on: ubuntu-latest
46+
47+
steps:
48+
- name: SCM Checkout
49+
uses: actions/checkout@v4
50+
51+
- name: Setup Python & Poetry Environment
52+
uses: ./.github/actions/python-environment
53+
with:
54+
python-version: "3.9"
55+
56+
- name: Run changelog update check
57+
run: poetry run nox -s changelog:updated
58+
4359
build-matrix:
4460
name: Generate Build Matrix
4561
uses: ./.github/workflows/matrix-python.yml

exasol/toolbox/nox/_documentation.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
PROJECT_CONFIG,
1212
Config,
1313
)
14+
import subprocess
15+
from pathlib import Path
16+
import sys
1417

1518

1619
def _build_docs(session: nox.Session, config: Config) -> None:
@@ -36,6 +39,19 @@ def _build_multiversion_docs(session: nox.Session, config: Config) -> None:
3639
)
3740

3841

42+
def _git_diff_changes_main() -> bool:
43+
p = subprocess.run(
44+
[
45+
"git",
46+
"diff",
47+
"main",
48+
"--quiet",
49+
Path(PROJECT_CONFIG.root, "doc/changes")
50+
],
51+
capture_output=True,
52+
)
53+
return bool(p.returncode)
54+
3955
@nox.session(name="docs:multiversion", python=False)
4056
def build_multiversion(session: Session) -> None:
4157
"""Builds the multiversion project documentation"""
@@ -64,3 +80,11 @@ def clean_docs(_session: Session) -> None:
6480
docs_folder = PROJECT_CONFIG.root / DOCS_OUTPUT_DIR
6581
if docs_folder.exists():
6682
shutil.rmtree(docs_folder)
83+
84+
85+
@nox.session(name="changelog:updated", python=False)
86+
def updated(_session: Session) -> None:
87+
"""Checks if the change log has been updated"""
88+
if not _git_diff_changes_main():
89+
print("Changelog have to be updated")
90+
sys.exit(1)

exasol/toolbox/nox/tasks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def check(session: Session) -> None:
5858
build_docs,
5959
clean_docs,
6060
open_docs,
61+
updated,
6162
)
6263
from exasol.toolbox.nox._release import prepare_release
6364
from exasol.toolbox.nox._shared import (

exasol/toolbox/templates/github/workflows/checks.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ jobs:
5050
name: Generate Build Matrix
5151
uses: ./.github/workflows/matrix-python.yml
5252

53+
Changelog:
54+
name: Changelog Update Check
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: SCM Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Setup Python & Poetry Environment
62+
uses: ./.github/actions/python-environment
63+
with:
64+
python-version: "3.9"
65+
66+
- name: Run changelog update check
67+
run: poetry run nox -s changelog:updated
68+
5369
Lint:
5470
name: Linting (Python-${{ matrix.python-version }})
5571
needs: [ Version-Check, build-matrix ]

0 commit comments

Comments
 (0)