Skip to content

Commit 123a385

Browse files
authored
Merge pull request #45 from GitGuardian/agateau/setup-scriv
Add a CHANGELOG
2 parents 5565085 + cc12175 commit 123a385

File tree

11 files changed

+369
-14
lines changed

11 files changed

+369
-14
lines changed

.github/workflows/changelog-check.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow only accepts PRs if they either contain a changelog fragment,
2+
# or have been applied the `skip-changelog` label.
3+
name: Changelog check
4+
5+
on:
6+
pull_request:
7+
types:
8+
# On by default if you specify no types.
9+
- 'opened'
10+
- 'reopened'
11+
- 'synchronize'
12+
# For `skip-changelog` only.
13+
- 'labeled'
14+
- 'unlabeled'
15+
16+
jobs:
17+
check-changelog:
18+
runs-on: ubuntu-22.04
19+
steps:
20+
- name: 'Check for changelog fragment'
21+
uses: brettcannon/[email protected]
22+
with:
23+
file-pattern: |
24+
changelog.d/*.md
25+
CHANGELOG.md
26+
skip-label: 'skip-changelog'
27+
failure-message: 'Missing a changelog fragment in ${file-pattern}. Please add one using `scriv create` or apply the `${skip-label}` label to the pull request'

.github/workflows/test-lint.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,26 @@ jobs:
4141
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
4242
steps:
4343
- uses: actions/checkout@v3
44+
4445
- name: Set up Python ${{ matrix.python-version }}
4546
uses: actions/setup-python@v1
4647
with:
4748
python-version: ${{ matrix.python-version }}
49+
4850
- name: Install dependencies
4951
run: |
5052
python -m pip install --upgrade pip
5153
python -m pip install --upgrade pipenv==2022.10.4
5254
pipenv install --system --dev --skip-lock
55+
5356
- name: Test with pytest
5457
run: |
5558
pipenv run coverage run --source pygitguardian -m pytest --disable-pytest-warnings
5659
pipenv run coverage report --fail-under=80
5760
pipenv run coverage xml
61+
env:
62+
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
63+
5864
- uses: codecov/codecov-action@v1
5965
with:
6066
file: ./coverage.xml
@@ -70,21 +76,31 @@ jobs:
7076
- uses: actions/checkout@v3
7177
with:
7278
fetch-depth: 0
79+
7380
- name: Set up Python
7481
uses: actions/setup-python@v2
7582
with:
7683
python-version: '3.x'
84+
7785
- name: Install dependencies
7886
run: python -m pip install --upgrade pip setuptools wheel
7987
- name: Build distribution
8088
run: >-
8189
python setup.py sdist bdist_wheel
90+
8291
- name: Publish distribution 📦 to PyPI
8392
uses: pypa/gh-action-pypi-publish@master
8493
with:
8594
user: __token__
8695
password: ${{ secrets.pypi_password }}
87-
- name: Release Notary Action
88-
uses: docker://aevea/release-notary:0.9.1
96+
97+
- name: Create Release
98+
id: create_release
99+
uses: actions/create-release@master
89100
env:
90101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
with:
103+
tag_name: ${{ steps.tags.outputs.tag }}
104+
release_name: ${{ steps.tags.outputs.tag }}
105+
draft: true
106+
prerelease: false

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
<a id='changelog-1.5.0'></a>
4+
5+
## 1.5.0 - 2022-11-28
6+
7+
### Added
8+
9+
- `Client` can now run IaC scans (gitguardian/ggshield#405).

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,9 @@ Line length in the one enforced by Black: 88 characters.
4545
- The first sentence starts with a capital letter and ends with a point. This sentence is separated from the others by a blank line
4646
- Docstrings must have :params: if the function has 2 or more arguments.
4747
- All docstrings must state the return object and raised exception with :return: and :raise:
48+
49+
### Changelog
50+
51+
We use [scriv](https://github.com/nedbat/scriv) to manage our changelog. It is automatically installed by `pipenv install --dev`.
52+
53+
All user visible changes must be documented in a changelog fragment. You can create one with `scriv create`. If your pull request only contains non-visible changes (such as refactors or fixes for regressions introduced _after_ the latest release), then apply the `skip-changelog` label to the pull request.

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ pytest = "*"
1717
vcrpy = "*"
1818
mypy = "==0.961"
1919
types-requests = "*"
20+
scriv = { version = "*", extras = ["toml"] }
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Removed
9+
10+
- A bullet item for the Removed category.
11+
12+
-->
13+
<!--
14+
### Added
15+
16+
- A bullet item for the Added category.
17+
18+
-->
19+
<!--
20+
### Changed
21+
22+
- A bullet item for the Changed category.
23+
24+
-->
25+
<!--
26+
### Deprecated
27+
28+
- A bullet item for the Deprecated category.
29+
30+
-->
31+
32+
### Fixed
33+
34+
- Python dependencies were not correctly defined: py-gitguardian was using `marshmallow-dataclass` and `click` without depending on them. The package now explicitly depends on `marshmallow-dataclass` and does not use `click` anymore (#43).
35+
36+
<!--
37+
### Security
38+
39+
- A bullet item for the Security category.
40+
41+
-->

changelog.d/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory holds changelog entries managed by scriv.

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ warn_unused_ignores = true
2626
[[tool.mypy.overrides]]
2727
module = ["tests.*", "examples.*"]
2828
ignore_errors = true
29+
30+
[tool.scriv]
31+
version = "literal: pygitguardian/__init__.py: __version__"
32+
format = "md"
33+
md_header_level = "2"
34+
insert_marker = "# Changelog"

0 commit comments

Comments
 (0)