winipedia-utils 0.2.47__py3-none-any.whl → 0.2.54__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 winipedia-utils might be problematic. Click here for more details.

@@ -3,8 +3,17 @@
3
3
  from typing import Any
4
4
 
5
5
 
6
- def _get_checkout_step(fetch_depth: int | None = None) -> dict[str, Any]:
7
- """Get the checkout step."""
6
+ def _get_checkout_step(
7
+ fetch_depth: int | None = None,
8
+ ) -> dict[str, Any]:
9
+ """Get the checkout step.
10
+
11
+ Args:
12
+ fetch_depth: The fetch depth to use. If None, no fetch depth is specified.
13
+
14
+ Returns:
15
+ The checkout step.
16
+ """
8
17
  step: dict[str, Any] = {
9
18
  "name": "Checkout repository",
10
19
  "uses": "actions/checkout@v5",
@@ -19,9 +28,30 @@ def _get_poetry_setup_steps(
19
28
  install_dependencies: bool = False,
20
29
  fetch_depth: int | None = None,
21
30
  configure_pipy_token: bool = False,
31
+ force_main_head: bool = False,
22
32
  ) -> list[dict[str, Any]]:
23
- """Get the poetry steps."""
33
+ """Get the poetry steps.
34
+
35
+ Args:
36
+ install_dependencies: Whether to install dependencies.
37
+ fetch_depth: The fetch depth to use. If None, no fetch depth is specified.
38
+ configure_pipy_token: Whether to configure the pipy token.
39
+ force_main_head: Whether to exit if the running branch or current commit is not
40
+ equal to the most recent commit on main. This is useful for workflows that
41
+ should only run on main.
42
+
43
+ Returns:
44
+ The poetry steps.
45
+ """
24
46
  steps = [_get_checkout_step(fetch_depth)]
47
+ if force_main_head:
48
+ # exit with code 1 if the running branch is not main
49
+ steps.append(
50
+ {
51
+ "name": "Assert running on head of main",
52
+ "run": 'git fetch origin main --depth=1; main_sha=$(git rev-parse origin/main); if [ "$GITHUB_SHA" != "$main_sha" ]; then echo "Tag commit is not the latest commit on main."; exit 1; fi', # noqa: E501
53
+ }
54
+ )
25
55
  steps.append(
26
56
  {
27
57
  "name": "Setup Python",
@@ -38,9 +38,7 @@ def _get_publish_config() -> dict[str, Any]:
38
38
  "workflow_run": {
39
39
  "workflows": [WORKFLOW_NAME],
40
40
  "types": ["completed"],
41
- "branches": ["main"],
42
41
  },
43
- "release": {"types": ["published"]},
44
42
  },
45
43
  "jobs": {
46
44
  "publish": {
@@ -35,7 +35,7 @@ def _get_release_config() -> dict[str, Any]:
35
35
  """Dict that represents the release workflow yaml."""
36
36
  return {
37
37
  "name": WORKFLOW_NAME,
38
- "on": {"push": {"tags": ["v*"], "branches": ["main"]}},
38
+ "on": {"push": {"tags": ["v*"]}},
39
39
  "permissions": {
40
40
  "contents": "write",
41
41
  },
@@ -47,6 +47,7 @@ def _get_release_config() -> dict[str, Any]:
47
47
  _get_poetry_setup_steps(
48
48
  install_dependencies=True,
49
49
  fetch_depth=0,
50
+ force_main_head=True,
50
51
  )
51
52
  ),
52
53
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winipedia-utils
3
- Version: 0.2.47
3
+ Version: 0.2.54
4
4
  Summary: A package with many utility functions
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -18,9 +18,9 @@ winipedia_utils/git/pre_commit/hooks.py,sha256=qBGZa4Gdp6E9Yqhd0boo2SZjDAK2Gzs0Q
18
18
  winipedia_utils/git/pre_commit/run_hooks.py,sha256=HFsomU-KV89gVLAzmHtLnwekldO8vpTX3Nmmp-aJc0g,1523
19
19
  winipedia_utils/git/workflows/__init__.py,sha256=BPdntTwFEyBMJ6MyT7gddPHswvRdH9tsRtfK72VSV7Y,57
20
20
  winipedia_utils/git/workflows/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
21
- winipedia_utils/git/workflows/base/base.py,sha256=BzcSpDZqxRNL0P_J3ztfc12H4_sPwzJvECNhranDwXA,1329
22
- winipedia_utils/git/workflows/publish.py,sha256=x8gjDXTUYvmYClpxTcPa3_t77FMv43mmz-2JWmLkn2E,2403
23
- winipedia_utils/git/workflows/release.py,sha256=VBB20jfZztRzlpVyBxs7mGk_0bTQ4NgJ17p-9eK7QOk,2811
21
+ winipedia_utils/git/workflows/base/base.py,sha256=pH-TF8ElvYNldLuo420WIArlEf6gkk1igfY42eytKGM,2413
22
+ winipedia_utils/git/workflows/publish.py,sha256=dGSJgkr3zVwwKHN8kt8ao-N4z6VyM2dW42chWWgsCYE,2316
23
+ winipedia_utils/git/workflows/release.py,sha256=oJCWnvQT05zqLJp75cliQhfuu2PFKnQ0Uw6Y-8r0QA4,2839
24
24
  winipedia_utils/iterating/__init__.py,sha256=rlF9hzxbowq5yOfcXvOKOQdB-EQmfrislQpf659Zeu4,53
25
25
  winipedia_utils/iterating/iterate.py,sha256=fP0cgEOmmwqt5wg6v61Kw3Jx9TtE8bC_a2jVd270NCM,944
26
26
  winipedia_utils/logging/__init__.py,sha256=AMt1LwA_E7hexYjMpGzUempoyDdAF-dowWvq59wC5aM,51
@@ -79,7 +79,7 @@ winipedia_utils/testing/tests/base/utils/utils.py,sha256=3c_SNbzjkQypzsc-BONo5C1
79
79
  winipedia_utils/testing/tests/conftest.py,sha256=BLgUJtLecOwuEsIyJ__0buqovd5AhiGvbMNk8CHgSQs,888
80
80
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
81
81
  winipedia_utils/text/string.py,sha256=yXmwOab5hXyVQG1NwlWDpy2prj0U7Vb2F5HKLT2Y77Q,3382
82
- winipedia_utils-0.2.47.dist-info/METADATA,sha256=DEck3H9nEtPQjSS3ogjTTZpPmu2CGq2_cBjQG6WAaD8,21020
83
- winipedia_utils-0.2.47.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
84
- winipedia_utils-0.2.47.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
85
- winipedia_utils-0.2.47.dist-info/RECORD,,
82
+ winipedia_utils-0.2.54.dist-info/METADATA,sha256=O7YpClfYrtAR0QPYUqqYVZASvZa_U-l1UKmhf8nYfKA,21020
83
+ winipedia_utils-0.2.54.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
84
+ winipedia_utils-0.2.54.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
85
+ winipedia_utils-0.2.54.dist-info/RECORD,,