-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
320 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: check-release-notes | ||
on: | ||
workflow_call: | ||
jobs: | ||
build: | ||
name: Check release notes | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.13 | ||
- name: Check release notes | ||
run: ./scripts/linkify_release_notes.py --check | ||
- name: Lookup version in release notes | ||
run: | | ||
VERSION=$(grep -Po '(?<=version = ")[^"]*' pyproject.toml) | ||
if ! grep -qF "## $VERSION " "docs/release-notes.md"; then | ||
echo "No release notes found for version '$VERSION'" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
|
||
## 2.0.0b8 (2025-01-15) | ||
|
||
#### Added | ||
* [#376](https://github.com/TheHive-Project/TheHive4py/pull/376) - Add `Has` query filter Fix deprecations, add warning for Contains by [@JuanTecedor](https://github.com/JuanTecedor) in [#377](https://github.com/TheHive-Project/TheHive4py/pull/377) | ||
* [#374](https://github.com/TheHive-Project/TheHive4py/pull/374) - Add new endpoint to be able to manage case templates by [@Anko59](https://github.com/Anko59) in [#375](https://github.com/TheHive-Project/TheHive4py/pull/375) | ||
|
||
#### Changed | ||
* [#370](https://github.com/TheHive-Project/TheHive4py/pull/370) - Enhance cortex endpoint with additional methods and types by [@Anko59](https://github.com/Anko59) in [#371](https://github.com/TheHive-Project/TheHive4py/pull/371) | ||
* [#376](https://github.com/TheHive-Project/TheHive4py/pull/376) - Fix outdated query filters to address corresponding TheHive warnings by [@JuanTecedor](https://github.com/JuanTecedor) in [#377](https://github.com/TheHive-Project/TheHive4py/pull/377) | ||
* [#380](https://github.com/TheHive-Project/TheHive4py/pull/380) - Update case and alert endpoint types by [@Kamforka](https://github.com/Kamforka) in [#383](https://github.com/TheHive-Project/TheHive4py/pull/383) | ||
|
||
#### Deprecated | ||
* [#361](https://github.com/TheHive-Project/TheHive4py/pull/361) - Add deprecation warning for python 3.8 by [@Kamforka](https://github.com/Kamforka) in [#384](https://github.com/TheHive-Project/TheHive4py/pull/384) | ||
* [#376](https://github.com/TheHive-Project/TheHive4py/pull/376) - Deprecate `Contains` query filter in favour of `Has` by [@JuanTecedor](https://github.com/JuanTecedor) in [#377](https://github.com/TheHive-Project/TheHive4py/pull/377) | ||
|
||
#### Other | ||
* [#362](https://github.com/TheHive-Project/TheHive4py/pull/362) - Add release.yml to better control auto generated release notes by [@Kamforka](https://github.com/Kamforka) in [#379](https://github.com/TheHive-Project/TheHive4py/pull/379) | ||
* [#372](https://github.com/TheHive-Project/TheHive4py/pull/372) - Use TheHive 5.4.5 in integration tests by [@Kamforka](https://github.com/Kamforka) in [#373](https://github.com/TheHive-Project/TheHive4py/pull/373) | ||
* [#381](https://github.com/TheHive-Project/TheHive4py/pull/381) - Use TheHive 5.4.6 in integration tests by [@Kamforka](https://github.com/Kamforka) in [#382](https://github.com/TheHive-Project/TheHive4py/pull/382) | ||
|
||
#### New Contributors | ||
* [@Anko59](https://github.com/Anko59) made their first contribution in [#371](https://github.com/TheHive-Project/TheHive4py/pull/371) | ||
* [@JuanTecedor](https://github.com/JuanTecedor) made their first contribution in [#377](https://github.com/TheHive-Project/TheHive4py/pull/377) | ||
|
||
**Full Changelog**: [2.0.0b7...2.0.0b8](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b7...2.0.0b8) | ||
|
||
## 2.0.0b7 (2024-11-24) | ||
|
||
#### Breaking changes | ||
* `TheHiveApi` client's `verify` argument was improperly set to the default value of `None`, which only raised a warning when the client was connecting to a TheHive instance with an `https://` base url. From now on `verify` will default to `True` that might lead to an SSL verification error, so to fix that one can: | ||
|
||
- pass the path to the cert bundle to be used by the client, e.g.: `verify=/path/to/cert/bundle.crt` | ||
- export the `REQUESTS_CA_BUNDLE` with the cert bundle path, e.g.: `REQUESTS_CA_BUNDLE=/path/to/cert/bundle.crt` | ||
- disable SSL verification like before - not recommended - e.g.: `verify=None` | ||
|
||
#### Deprecated | ||
* [TheHiveApi.case.update](https://github.com/TheHive-Project/TheHive4py/blob/b3162f695368aefe200740acebd157dfba503e23/thehive4py/endpoints/case.py#L43) method's `case` argument is going to be retired in favor of the `fields` argument to conform with other endpoints update methods. | ||
|
||
#### Added | ||
* [#339](https://github.com/TheHive-Project/TheHive4py/pull/339) - add codecov action by [@Kamforka](https://github.com/Kamforka) in [#342](https://github.com/TheHive-Project/TheHive4py/pull/342) | ||
* [#339](https://github.com/TheHive-Project/TheHive4py/pull/339) - add workflow trigger on merge to main by [@Kamforka](https://github.com/Kamforka) in [#343](https://github.com/TheHive-Project/TheHive4py/pull/343) | ||
* [#347](https://github.com/TheHive-Project/TheHive4py/pull/347) - Add support for Python 3.13 by [@Kamforka](https://github.com/Kamforka) in [#349](https://github.com/TheHive-Project/TheHive4py/pull/349) | ||
* [#345](https://github.com/TheHive-Project/TheHive4py/pull/345) - Add initial mkdocs page by [@Kamforka](https://github.com/Kamforka) in [#346](https://github.com/TheHive-Project/TheHive4py/pull/346) | ||
* [#301](https://github.com/TheHive-Project/TheHive4py/pull/301) - Add client, alert and api reference docs by [@Kamforka](https://github.com/Kamforka) in [#350](https://github.com/TheHive-Project/TheHive4py/pull/350) | ||
* [#340](https://github.com/TheHive-Project/TheHive4py/pull/340) - Add retry mechanism by [@Kamforka](https://github.com/Kamforka) in [#344](https://github.com/TheHive-Project/TheHive4py/pull/344) | ||
|
||
#### Changed | ||
* Patch important note sections in README by [@Kamforka](https://github.com/Kamforka) in [#337](https://github.com/TheHive-Project/TheHive4py/pull/337) | ||
* Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows by [@dependabot](https://github.com/dependabot) in [#338](https://github.com/TheHive-Project/TheHive4py/pull/338) | ||
* [#301](https://github.com/TheHive-Project/TheHive4py/pull/301) - Adjust thehive4py title's font size by [@Kamforka](https://github.com/Kamforka) in [#357](https://github.com/TheHive-Project/TheHive4py/pull/357) | ||
* [#359](https://github.com/TheHive-Project/TheHive4py/pull/359) - Upgrade test integrator to use v5.4.2 by [@Kamforka](https://github.com/Kamforka) in [#360](https://github.com/TheHive-Project/TheHive4py/pull/360) | ||
|
||
#### New Contributors | ||
* [@dependabot](https://github.com/dependabot) made their first contribution in [#338](https://github.com/TheHive-Project/TheHive4py/pull/338) | ||
|
||
**Full Changelog**: [2.0.0b6...2.0.0b7](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b6...2.0.0b7) | ||
|
||
## 2.0.0b6 (2024-08-28) | ||
|
||
#### What's Changed | ||
* Review task type hints by [@Kamforka](https://github.com/Kamforka) in [#318](https://github.com/TheHive-Project/TheHive4py/pull/318) | ||
* Extend alert endpoint with attachment methods by [@Kamforka](https://github.com/Kamforka) in [#321](https://github.com/TheHive-Project/TheHive4py/pull/321) | ||
* Rework test container by [@Kamforka](https://github.com/Kamforka) in [#326](https://github.com/TheHive-Project/TheHive4py/pull/326) | ||
* Align pyproject.toml to Git Repo License of MIT by [@jamesmckibbenathrb](https://github.com/jamesmckibbenathrb) in [#330](https://github.com/TheHive-Project/TheHive4py/pull/330) | ||
* Update TheHive icon link in README.md by [@Kamforka](https://github.com/Kamforka) in [#331](https://github.com/TheHive-Project/TheHive4py/pull/331) | ||
* Add a generic query endpoint and align case update fields with other update methods by [@Kamforka](https://github.com/Kamforka) in [#334](https://github.com/TheHive-Project/TheHive4py/pull/334) | ||
|
||
#### New Contributors | ||
* [@jamesmckibbenathrb](https://github.com/jamesmckibbenathrb) made their first contribution in [#330](https://github.com/TheHive-Project/TheHive4py/pull/330) | ||
|
||
**Full Changelog**: [2.0.0b5...2.0.0b6](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b5...2.0.0b6) | ||
|
||
|
||
## 2.0.0b5 (2023-10-13) | ||
|
||
#### What's Changed | ||
Merged Pull Requests | ||
* Delete unused setup.py by [@Kamforka](https://github.com/Kamforka) in [#298](https://github.com/TheHive-Project/TheHive4py/pull/298) | ||
* Actualize main with develop by [@Kamforka](https://github.com/Kamforka) in [#297](https://github.com/TheHive-Project/TheHive4py/pull/297) | ||
* Enhance readme by [@Kamforka](https://github.com/Kamforka) in [#299](https://github.com/TheHive-Project/TheHive4py/pull/299) | ||
* Add deployment workflow by [@Kamforka](https://github.com/Kamforka) in [#300](https://github.com/TheHive-Project/TheHive4py/pull/300) | ||
* Update important note and add query examples by [@Kamforka](https://github.com/Kamforka) in [#305](https://github.com/TheHive-Project/TheHive4py/pull/305) | ||
* Change to MIT license by [@Kamforka](https://github.com/Kamforka) in [#306](https://github.com/TheHive-Project/TheHive4py/pull/306) | ||
* Get rid of setup.cfg by [@Kamforka](https://github.com/Kamforka) in [#309](https://github.com/TheHive-Project/TheHive4py/pull/309) | ||
* Fix and update filters by [@Kamforka](https://github.com/Kamforka) in [#310](https://github.com/TheHive-Project/TheHive4py/pull/310) | ||
* Bump thehive4py-integrator to v5.2.5 by [@Kamforka](https://github.com/Kamforka) in [#312](https://github.com/TheHive-Project/TheHive4py/pull/312) | ||
|
||
|
||
**Full Changelog**: [2.0.0b4...2.0.0b5](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b4...2.0.0b5) | ||
|
||
## 2.0.0b4 (2023-01-20) | ||
|
||
[Full Changelog](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b3...2.0.0b4) | ||
|
||
**Closed issues:** | ||
|
||
- Add case and alert TTPs operations [\#268](https://github.com/TheHive-Project/TheHive4py/issues/268) | ||
- How to perform a bulk-insert of observables [\#263](https://github.com/TheHive-Project/TheHive4py/issues/263) | ||
|
||
**Merged pull requests:** | ||
|
||
- add py.typed to the project to please mypy and make the library PEP-561 compliant [\#272](https://github.com/TheHive-Project/TheHive4py/pull/272) ([Kamforka](https://github.com/Kamforka)) | ||
- 268 add case and alert ttps operations [\#271](https://github.com/TheHive-Project/TheHive4py/pull/271) ([Kamforka](https://github.com/Kamforka)) | ||
- Test observable attachment download [\#270](https://github.com/TheHive-Project/TheHive4py/pull/270) ([Kamforka](https://github.com/Kamforka)) | ||
- Add parameters to method alert.promote\_to\_case\(\) [\#269](https://github.com/TheHive-Project/TheHive4py/pull/269) ([vdebergue](https://github.com/vdebergue)) | ||
- Update README.md [\#267](https://github.com/TheHive-Project/TheHive4py/pull/267) ([ater49](https://github.com/ater49)) | ||
- Download an attachment from an observable [\#266](https://github.com/TheHive-Project/TheHive4py/pull/266) ([mike1796](https://github.com/mike1796)) | ||
- Create local ci commands for devs [\#265](https://github.com/TheHive-Project/TheHive4py/pull/265) ([Kamforka](https://github.com/Kamforka)) | ||
- Add observableType endpoints [\#264](https://github.com/TheHive-Project/TheHive4py/pull/264) ([Black-Pearl25](https://github.com/Black-Pearl25)) | ||
- Migrate to pyproject.toml [\#262](https://github.com/TheHive-Project/TheHive4py/pull/262) ([Kamforka](https://github.com/Kamforka)) | ||
- Add basic ci workflow [\#261](https://github.com/TheHive-Project/TheHive4py/pull/261) ([Kamforka](https://github.com/Kamforka)) | ||
|
||
## 2.0.0b3 (2022-10-24) | ||
|
||
[Full Changelog](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b2...2.0.0b3) | ||
|
||
**Closed issues:** | ||
|
||
- Use between with 2 dates [\#257](https://github.com/TheHive-Project/TheHive4py/issues/257) | ||
- JSONDecodeError not caught correctly when using AWS Lambda [\#255](https://github.com/TheHive-Project/TheHive4py/issues/255) | ||
- thehive4py==1.8.1 Code Erroe [\#254](https://github.com/TheHive-Project/TheHive4py/issues/254) | ||
|
||
**Merged pull requests:** | ||
|
||
- Set InputAlert's date property as optional [\#260](https://github.com/TheHive-Project/TheHive4py/pull/260) ([Kamforka](https://github.com/Kamforka)) | ||
- Use json.loads instead of relying on requests' json method [\#259](https://github.com/TheHive-Project/TheHive4py/pull/259) ([Kamforka](https://github.com/Kamforka)) | ||
- Persist error response data in TheHiveError [\#258](https://github.com/TheHive-Project/TheHive4py/pull/258) ([Kamforka](https://github.com/Kamforka)) | ||
|
||
## 2.0.0b2 (2022-08-20) | ||
|
||
#### What's Changed | ||
* [#250](https://github.com/TheHive-Project/TheHive4py/pull/250) - Implement list comment methods for alerts and cases by [@Kamforka](https://github.com/Kamforka) in [#251](https://github.com/TheHive-Project/TheHive4py/pull/251) | ||
* [fr] ability to manage multi valued customfields by [@Kamforka](https://github.com/Kamforka) in [#253](https://github.com/TheHive-Project/TheHive4py/pull/253) | ||
|
||
|
||
**Full Changelog**: [2.0.0b1..2.0.0b2](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b1..2.0.0b2) | ||
|
||
|
||
## 2.0.0b1 (2022-08-05) | ||
|
||
#### What's Changed | ||
* [#250](https://github.com/TheHive-Project/TheHive4py/pull/250) - Implement list comment methods for alerts and cases by [@Kamforka](https://github.com/Kamforka) in [#251](https://github.com/TheHive-Project/TheHive4py/pull/251) | ||
|
||
|
||
**Full Changelog**: [2.0.0b0...2.0.0b1](https://github.com/TheHive-Project/TheHive4py/compare/2.0.0b0...2.0.0b1) | ||
|
||
## 2.0.0b0 (2022-08-05) | ||
|
||
#### What's Changed | ||
* Update for 5.0.1 by [@vdebergue](https://github.com/vdebergue) in [#241](https://github.com/TheHive-Project/TheHive4py/pull/241) | ||
* added case.set_share by [@migueldo](https://github.com/migueldo) in [#242](https://github.com/TheHive-Project/TheHive4py/pull/242) | ||
|
||
#### New Contributors | ||
* [@vdebergue](https://github.com/vdebergue) made their first contribution in [#241](https://github.com/TheHive-Project/TheHive4py/pull/241) | ||
* [@migueldo](https://github.com/migueldo) made their first contribution in [#242](https://github.com/TheHive-Project/TheHive4py/pull/242) | ||
|
||
**Full Changelog**: [2.0.0b0](https://github.com/TheHive-Project/TheHive4py/commits/2.0.0b0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
#!/usr/bin/env python | ||
import argparse | ||
import re | ||
|
||
|
||
def replace_pr_reference(match: re.Match) -> str: | ||
pr_number = match.groups()[0] | ||
pr_link = ( | ||
f" [#{pr_number}]" | ||
"(https://github.com/TheHive-Project/TheHive4py/pull/{pr_number})" | ||
) | ||
print(f"Replace `{match.group()}` by `{pr_link}`") | ||
return pr_link | ||
|
||
|
||
def linkify_pr_references(release_notes: str) -> str: | ||
pr_ref_pattern = r" #(\d+)" | ||
linkified_release_notes = re.sub( | ||
pattern=pr_ref_pattern, | ||
repl=replace_pr_reference, | ||
string=release_notes, | ||
) | ||
return linkified_release_notes | ||
|
||
|
||
def replace_pr_url(match: re.Match) -> str: | ||
pr_url, pr_number = match.groups() | ||
pr_link = f" [#{pr_number}]({pr_url})" | ||
print(f"Replace `{match.group()}` by `{pr_link}`") | ||
return pr_link | ||
|
||
|
||
def linkify_pr_urls(release_notes: str) -> str: | ||
pr_url_pattern = ( | ||
r" (https:\/\/github\.com\/TheHive-Project\/TheHive4py\/pull\/(\d+))" | ||
) | ||
|
||
linkified_release_notes = re.sub( | ||
pattern=pr_url_pattern, | ||
repl=replace_pr_url, | ||
string=release_notes, | ||
) | ||
return linkified_release_notes | ||
|
||
|
||
def replace_contributor_reference(match: re.Match) -> str: | ||
contributor = match.groups()[0] | ||
contributor_link = f" [@{contributor}](https://github.com/{contributor})" | ||
print(f"Replace `{match.group()}` by `{contributor_link}`") | ||
return contributor_link | ||
|
||
|
||
def linkify_contributor_references(release_notes: str) -> str: | ||
contributor_ref_pattern = r" @(\w+)" | ||
|
||
linkified_release_notes = re.sub( | ||
pattern=contributor_ref_pattern, | ||
repl=replace_contributor_reference, | ||
string=release_notes, | ||
) | ||
return linkified_release_notes | ||
|
||
|
||
def replace_full_changelog_url(match: re.Match) -> str: | ||
changelog_url, changelog_tags = match.groups() | ||
full_changelog_link = f" [{changelog_tags}]({changelog_url})" | ||
print(f"Replace `{match.group()}` by `{full_changelog_link}`") | ||
return full_changelog_link | ||
|
||
|
||
def linkify_full_changelog_urls(release_notes: str) -> str: | ||
full_changelog_url_pattern = ( | ||
r" (https:\/\/github\.com/TheHive-Project\/TheHive4py\/compare\/(.+\.\.\..+))" | ||
) | ||
|
||
linkified_release_notes = re.sub( | ||
pattern=full_changelog_url_pattern, | ||
repl=replace_full_changelog_url, | ||
string=release_notes, | ||
) | ||
return linkified_release_notes | ||
|
||
|
||
def parse_arguments(): | ||
parser = argparse.ArgumentParser( | ||
prog="linkify-release-notes", | ||
description=("enhance release notes with markdown links"), | ||
) | ||
parser.add_argument( | ||
"-c", | ||
"--check", | ||
action="store_true", | ||
default=False, | ||
help="just check for link replacements", | ||
) | ||
|
||
return parser.parse_args() | ||
|
||
|
||
def main(): | ||
|
||
args = parse_arguments() | ||
|
||
release_notes_path = "docs/release-notes.md" | ||
with open(release_notes_path) as release_notes_fp: | ||
release_notes = release_notes_fp.read() | ||
|
||
print(f"Checking linkification in '{release_notes_path}'") | ||
linkified_release_notes = release_notes | ||
linkified_release_notes = linkify_pr_references( | ||
release_notes=linkified_release_notes | ||
) | ||
linkified_release_notes = linkify_pr_urls(release_notes=linkified_release_notes) | ||
linkified_release_notes = linkify_contributor_references( | ||
release_notes=linkified_release_notes | ||
) | ||
linkified_release_notes = linkify_full_changelog_urls( | ||
release_notes=linkified_release_notes | ||
) | ||
|
||
if linkified_release_notes == release_notes: | ||
print("Nothing to do, release notes are already linkified!") | ||
return | ||
|
||
if args.check: | ||
print("The `--check` flag is active, exiting without replacing!") | ||
exit(1) | ||
|
||
with open(release_notes_path, "w") as linkified_release_notes_fp: | ||
linkified_release_notes_fp.write(linkified_release_notes) | ||
|
||
print(f"Successfully linkified '{release_notes_path}'!") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |