From 37b02135b21047b2ff8270ea9f3db2f73db56025 Mon Sep 17 00:00:00 2001 From: Jan Buchar Date: Wed, 16 Oct 2024 19:54:45 +0200 Subject: [PATCH] Remove obsolete scripts --- cliff.toml | 102 --------------------------- scripts/fetch_pr_issues.sh | 32 --------- scripts/preprocess_commit_message.py | 54 -------------- 3 files changed, 188 deletions(-) delete mode 100644 cliff.toml delete mode 100755 scripts/fetch_pr_issues.sh delete mode 100644 scripts/preprocess_commit_message.py diff --git a/cliff.toml b/cliff.toml deleted file mode 100644 index 390270a52..000000000 --- a/cliff.toml +++ /dev/null @@ -1,102 +0,0 @@ -# git-cliff ~ default configuration file -# https://git-cliff.org/docs/configuration -# -# Lines starting with "#" are comments. -# Configuration options are organized into tables and keys. -# See documentation for more information on available options. - -[changelog] -# changelog header -header = """ -# Changelog\n -All notable changes to this project will be documented in this file.\n -""" -# template for the changelog body -# https://keats.github.io/tera/docs/#introduction -body = """ -{% if version %}\ - ## [{{ version | trim_start_matches(pat="v") }}](/releases/tag/{{ version }}) ({{ timestamp | date(format="%Y-%m-%d") }}) -{% elif message %}\ - ## {{ message | trim_start_matches(pat="v") }} - **not yet released** -{% else %}\ - ## unreleased -{% endif %}\ -{% for group, commits in commits | group_by(attribute="group") %} - ### {{ group | striptags | trim | upper_first }} - {% for commit in commits %} - - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ - {% if commit.breaking %}[**breaking**] {% endif %}\ - {{ commit.message | upper_first }} ([{{ commit.id | truncate(length = 7, end = "") }}](/commit/{{ commit.id }}))\ - {% if commit.github.username %} by [@{{ commit.github.username }}](https://github.com/{{ commit.github.username }}){%- endif %}\ - {% endfor %} -{% endfor %}\n -""" -# template for the changelog footer -footer = """ - -""" -# remove the leading and trailing s -trim = true -# postprocessors -postprocessors = [ - { pattern = '', replace = "https://github.com/apify/crawlee-python" }, # replace repository URL -] - -[bump] -# With 0.x.y version, breaking commits should only increase the minor version and feature commits should only increase the patch version -breaking_always_bump_major = false -features_always_bump_minor = false - -[git] -# parse the commits based on https://www.conventionalcommits.org -conventional_commits = true -# filter out the commits that are not conventional -filter_unconventional = true -# process each line of a commit as an individual commit -split_commits = false -# regex for preprocessing the commit messages -commit_preprocessors = [ - # Replace PR and issue numbers in commit messages - { pattern = '.*', replace_command = 'python scripts/preprocess_commit_message.py'}, - # Check spelling of the commit with https://github.com/crate-ci/typos - # If the spelling is incorrect, it will be automatically fixed. - #{ pattern = '.*', replace_command = 'typos --write-changes -' }, -] -# regex for parsing and grouping commits -commit_parsers = [ - { message = "^feat", group = "๐Ÿš€ Features" }, - { message = "^fix|^bug", group = "๐Ÿ› Bug Fixes" }, - # { message = "^doc", group = "๐Ÿ“š Documentation" }, - { message = "^doc", skip = true }, - { message = "^perf", group = "โšก Performance" }, - # { message = "^refactor", group = "๐Ÿšœ Refactor" }, - { message = "^refactor", skip = true }, - # { message = "^style", group = "๐ŸŽจ Styling" }, - { message = "^style", skip = true }, - # { message = "^test", group = "๐Ÿงช Testing" }, - { message = "^test", skip = true }, - { message = "^chore\\(release\\): prepare for", skip = true }, - { message = "^chore\\(deps.*\\)", skip = true }, - { message = "^chore\\(pr\\)", skip = true }, - { message = "^chore\\(pull\\)", skip = true }, - # { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, - { message = "^chore|^ci", skip = true }, - { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, - { message = "^revert", group = "โ—€๏ธ Revert" }, -] -# protect breaking changes from being skipped due to matching a skipping commit_parser -protect_breaking_commits = true -# filter out the commits that are not matched by commit parsers -filter_commits = false -# regex for matching git tags -tag_pattern = "v[0-9]+\\." -# sort the tags topologically -topo_order = false -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" -# limit the number of commits included in the changelog. -# limit_commits = 42 - -[remote.github] -owner = "apify" -repo = "crawlee-python" diff --git a/scripts/fetch_pr_issues.sh b/scripts/fetch_pr_issues.sh deleted file mode 100755 index 4e3b82b33..000000000 --- a/scripts/fetch_pr_issues.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -gh api graphql --paginate --slurp \ - -F owner='apify' \ - -F repo='crawlee-python' \ - -f query=' - query ($owner: String!, $repo: String!, $endCursor: String) { - repository(owner: $owner, name: $repo) { - pullRequests(first: 100, after: $endCursor) { - nodes { - number, - closingIssuesReferences(last: 100) { - nodes { number } - } - } - pageInfo { - hasNextPage - endCursor - } - } - } - } - ' | -jq ' - [ - [.[] | .data.repository.pullRequests.nodes ] - | flatten[] - | { - (.number | tostring): - [.closingIssuesReferences.nodes | .[] | .number] - } - ] | add' > pullRequestIssues.json diff --git a/scripts/preprocess_commit_message.py b/scripts/preprocess_commit_message.py deleted file mode 100644 index 30711496f..000000000 --- a/scripts/preprocess_commit_message.py +++ /dev/null @@ -1,54 +0,0 @@ -from __future__ import annotations - -import json -import re -import subprocess -import sys -from pathlib import Path - -pr_issues_file = Path.cwd() / 'pullRequestIssues.json' - - -def load_pr_issues() -> dict[int, list[int]]: - if pr_issues_file.exists(): - return {int(key): value for key, value in json.load(pr_issues_file.open('r')).items()} - - return {} - - -def issue_link(issue_number: int) -> str: - return f'[#{issue_number}](/issues/{issue_number})' - - -def pr_link(pr_number: int) -> str: - return f'[#{pr_number}](/pull/{pr_number})' - - -def replace_issue_or_pull_request_number(match: re.Match) -> str: - item_number = int(match.group(2)) - - pr_to_issues = load_pr_issues() - - if item_number not in pr_to_issues: - subprocess.check_call(str(Path(__file__).parent / 'fetch_pr_issues.sh')) # noqa: S603 - pr_to_issues = load_pr_issues() - - issue_links = [issue_link(issue_number) for issue_number in pr_to_issues.get(item_number, [])] - - if item_number not in pr_to_issues: - return f'({issue_link(item_number)})' - - if not issue_links: - return f'({pr_link(item_number)})' - - return f'({pr_link(item_number)}, closes {", ".join(issue_links)})' - - -if __name__ == '__main__': - print( - re.sub( - r'\((\w+\s)?#([0-9]+)\)', - repl=replace_issue_or_pull_request_number, - string=sys.stdin.read(), - ) - )