gha-utils 4.5.0__py3-none-any.whl → 4.5.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gha-utils might be problematic. Click here for more details.

gha_utils/__init__.py CHANGED
@@ -17,4 +17,4 @@
17
17
 
18
18
  from __future__ import annotations
19
19
 
20
- __version__ = "4.5.0"
20
+ __version__ = "4.5.2"
gha_utils/changelog.py CHANGED
@@ -69,14 +69,14 @@ class Changelog:
69
69
 
70
70
  ! ## [2.17.5 (unreleased)](https://github.com/kdeldycke/workflows/compare/v2.17.4...main)
71
71
 
72
- > \[!IMPORTANT\]
72
+ > [!IMPORTANT]
73
73
  > This version is not released yet and is under active development.
74
74
  --- 1,6 ----
75
75
  # Changelog
76
76
 
77
77
  ! ## [2.17.6 (unreleased)](https://github.com/kdeldycke/workflows/compare/v2.17.4...main)
78
78
 
79
- > \[!IMPORTANT\]
79
+ > [!IMPORTANT]
80
80
  > This version is not released yet and is under active development.
81
81
  Would write to config file pyproject.toml:
82
82
  *** before pyproject.toml
@@ -101,7 +101,7 @@ class Changelog:
101
101
  # Extract current version as defined by bump-my-version.
102
102
  config_file = Path("./pyproject.toml").resolve()
103
103
  logging.info(f"Open {config_file}")
104
- config = tomllib.loads(config_file.read_text(encoding="utf-8"))
104
+ config = tomllib.loads(config_file.read_text(encoding="UTF-8"))
105
105
  current_version = config["tool"]["bumpversion"]["current_version"]
106
106
  logging.info(f"Current version: {current_version}")
107
107
  assert current_version
@@ -136,12 +136,11 @@ class Changelog:
136
136
  new_entry = re.sub(
137
137
  r"\n\n.*",
138
138
  "\n\n"
139
- "> \\[!IMPORTANT\\]\n"
139
+ "> [!IMPORTANT]\n"
140
140
  "> This version is not released yet and is under active development.\n\n",
141
141
  new_entry,
142
142
  flags=re.MULTILINE | re.DOTALL,
143
143
  )
144
- new_entry = f"{SECTION_START}{new_entry}"
145
144
  logging.info("New generated section:\n" + indent(new_entry, " " * 2))
146
145
 
147
146
  # No need to update.
gha_utils/cli.py CHANGED
@@ -21,6 +21,7 @@ import os
21
21
  import sys
22
22
  from datetime import datetime
23
23
  from pathlib import Path
24
+ from typing import IO
24
25
 
25
26
  from click_extra import (
26
27
  Choice,
@@ -41,13 +42,18 @@ from .metadata import Dialects, Metadata
41
42
 
42
43
 
43
44
  def is_stdout(filepath: Path) -> bool:
45
+ """Check if a file path is set to stdout.
46
+
47
+ Prevents the creation of a ``-`` file in the current directory.
48
+ """
44
49
  return str(filepath) == "-"
45
50
 
46
51
 
47
- def handle_stdout(filepath: Path) -> Path | None:
52
+ def prep_path(filepath: Path) -> IO | None:
53
+ """Prepare the output file parameter for Click's echo function."""
48
54
  if is_stdout(filepath):
49
55
  return None
50
- return filepath
56
+ return filepath.open("w", encoding="UTF-8")
51
57
 
52
58
 
53
59
  def generate_header(ctx: Context) -> str:
@@ -157,7 +163,7 @@ def metadata(ctx, format, overwrite, output_path):
157
163
 
158
164
  dialect = Dialects(format)
159
165
  content = metadata.dump(dialect=dialect)
160
- echo(content, file=handle_stdout(output_path))
166
+ echo(content, file=prep_path(output_path))
161
167
 
162
168
 
163
169
  @gha_utils.command(short_help="Maintain a Markdown-formatted changelog")
@@ -189,7 +195,7 @@ def changelog(ctx, source, changelog_path):
189
195
  logging.info(f"Print updated results to {sys.stdout.name}")
190
196
  else:
191
197
  logging.info(f"Save updated results to {changelog_path}")
192
- echo(content, file=handle_stdout(changelog_path))
198
+ echo(content, file=prep_path(changelog_path))
193
199
 
194
200
 
195
201
  @gha_utils.command(short_help="Update Git's .mailmap file with missing contributors")
@@ -263,4 +269,4 @@ def mailmap_sync(ctx, source, create_if_missing, destination_mailmap):
263
269
  logging.warning("Nothing to update, stop the sync process.")
264
270
  ctx.exit()
265
271
 
266
- echo(generate_header(ctx) + new_content, file=handle_stdout(destination_mailmap))
272
+ echo(generate_header(ctx) + new_content, file=prep_path(destination_mailmap))
gha_utils/mailmap.py CHANGED
@@ -131,7 +131,7 @@ class Mailmap:
131
131
 
132
132
  git_cli = ("git", "log", "--pretty=format:%aN <%aE>%n%cN <%cE>")
133
133
  logging.debug(f"Run: {' '.join(git_cli)}")
134
- process = run(git_cli, capture_output=True, encoding="utf-8")
134
+ process = run(git_cli, capture_output=True, encoding="UTF-8")
135
135
 
136
136
  # Parse git CLI output.
137
137
  if process.returncode:
gha_utils/metadata.py CHANGED
@@ -626,7 +626,7 @@ class Metadata:
626
626
  ``pyproject.toml`` exists and respects the standards. ``False`` otherwise.
627
627
  """
628
628
  if self.pyproject_path.exists() and self.pyproject_path.is_file():
629
- toml = tomllib.loads(self.pyproject_path.read_text(encoding="utf-8"))
629
+ toml = tomllib.loads(self.pyproject_path.read_text(encoding="UTF-8"))
630
630
  try:
631
631
  metadata = StandardMetadata.from_pyproject(toml)
632
632
  self._is_python_project = True
@@ -1104,7 +1104,7 @@ class Metadata:
1104
1104
  changes = ""
1105
1105
  match = re.search(
1106
1106
  rf"^##(?P<title>.+{escape(version)} .+?)\n(?P<changes>.*?)\n##",
1107
- Path("./changelog.md").read_text(encoding="utf-8"),
1107
+ Path("./changelog.md").read_text(encoding="UTF-8"),
1108
1108
  flags=re.MULTILINE | re.DOTALL,
1109
1109
  )
1110
1110
  if match:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: gha-utils
3
- Version: 4.5.0
3
+ Version: 4.5.2
4
4
  Summary: ⚙️ CLI helpers for GitHub Actions + reuseable workflows
5
5
  Author-email: Kevin Deldycke <kevin@deldycke.com>
6
6
  Project-URL: Homepage, https://github.com/kdeldycke/workflows
@@ -0,0 +1,12 @@
1
+ gha_utils/__init__.py,sha256=dVbNU3AKtU7SNZ3K7bIcJ2IZFIPUJZrzkCoRMaHw1v8,865
2
+ gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
3
+ gha_utils/changelog.py,sha256=poWmTWmTYWu7-zwfKKbIlqBQv9qoAJeFhTcZWH9Fl1c,5865
4
+ gha_utils/cli.py,sha256=NlOktO7ddL8fhwkXEB3fVw3Qj-37maWnrYpyL_cKgHw,9202
5
+ gha_utils/mailmap.py,sha256=snSQBn1BDZ21783l4yCkQc3RLIxh5X6QCunFRkDj-24,6301
6
+ gha_utils/metadata.py,sha256=qdhAH-NHPusWIicoN9Js-7idvkcnJa9wzF4mVi7giPY,47203
7
+ gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ gha_utils-4.5.2.dist-info/METADATA,sha256=OBVWECS5Kq8WiOKI0S9MxtX4uzy4xHxQIF68BVmql5A,17976
9
+ gha_utils-4.5.2.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
10
+ gha_utils-4.5.2.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
11
+ gha_utils-4.5.2.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
12
+ gha_utils-4.5.2.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- gha_utils/__init__.py,sha256=2hpwFw1Fxf-LQg9Elgz4VZow1ivxy9LI5LEfSKa3mQY,865
2
- gha_utils/__main__.py,sha256=Dck9BjpLXmIRS83k0mghAMcYVYiMiFLltQdfRuMSP_Q,1703
3
- gha_utils/changelog.py,sha256=-Iek7GkoM2MhUVQ_CloQzSMMUvX0TfDLytbDuZmrPRs,5923
4
- gha_utils/cli.py,sha256=WE8Pi4Ga3S_2cn2u2RT7XC6ngrXhrQE4UnFwNOPW6Ec,8976
5
- gha_utils/mailmap.py,sha256=sum4XIme2Dis7XtHyO9U7ogWelZwqb-yvJ5I92PPnqg,6301
6
- gha_utils/metadata.py,sha256=FLkNjjAlB3FieMgvbtBQwWnA7tE6APEGnGHgbe8gbZg,47203
7
- gha_utils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- gha_utils-4.5.0.dist-info/METADATA,sha256=HfmzzdwWWdQ6kyXh0T_rsTJIZdK9KMZMemCaTg8CnHs,17976
9
- gha_utils-4.5.0.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
10
- gha_utils-4.5.0.dist-info/entry_points.txt,sha256=8bJOwQYf9ZqsLhBR6gUCzvwLNI9f8tiiBrJ3AR0EK4o,54
11
- gha_utils-4.5.0.dist-info/top_level.txt,sha256=C94Blb61YkkyPBwCdM3J_JPDjWH0lnKa5nGZeZ5M6yE,10
12
- gha_utils-4.5.0.dist-info/RECORD,,