winipedia-utils 0.4.12__py3-none-any.whl → 0.4.20__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.

@@ -85,11 +85,17 @@ class Workflow(YamlConfigFile):
85
85
  return f"{cls.get_workflow_name()}"
86
86
 
87
87
  @classmethod
88
- def get_checkout_step(cls, fetch_depth: int | None = None) -> dict[str, Any]:
88
+ def get_checkout_step(
89
+ cls,
90
+ fetch_depth: int | None = None,
91
+ *,
92
+ token: bool = False,
93
+ ) -> dict[str, Any]:
89
94
  """Get the checkout step.
90
95
 
91
96
  Args:
92
97
  fetch_depth: The fetch depth to use. If None, no fetch depth is specified.
98
+ token: Whether to use the repository token.
93
99
 
94
100
  Returns:
95
101
  The checkout step.
@@ -99,7 +105,10 @@ class Workflow(YamlConfigFile):
99
105
  "uses": "actions/checkout@main",
100
106
  }
101
107
  if fetch_depth is not None:
102
- step["with"] = {"fetch-depth": fetch_depth}
108
+ step.setdefault("with", {})["fetch-depth"] = fetch_depth
109
+
110
+ if token:
111
+ step.setdefault("with", {})["token"] = cls.get_repo_token()
103
112
  return step
104
113
 
105
114
  @classmethod
@@ -110,6 +119,7 @@ class Workflow(YamlConfigFile):
110
119
  fetch_depth: int | None = None,
111
120
  configure_pipy_token: bool = False,
112
121
  force_main_head: bool = False,
122
+ token: bool = False,
113
123
  ) -> list[dict[str, Any]]:
114
124
  """Get the poetry steps.
115
125
 
@@ -120,11 +130,12 @@ class Workflow(YamlConfigFile):
120
130
  force_main_head: Whether to exit if the running branch or current commit is not
121
131
  equal to the most recent commit on main. This is useful for workflows that
122
132
  should only run on main.
133
+ token: Whether to use the repository token.
123
134
 
124
135
  Returns:
125
136
  The poetry steps.
126
137
  """
127
- steps = [cls.get_checkout_step(fetch_depth)]
138
+ steps = [cls.get_checkout_step(fetch_depth, token=token)]
128
139
  if force_main_head:
129
140
  # exit with code 1 if the running branch is not main
130
141
  steps.append(
@@ -133,6 +144,7 @@ class Workflow(YamlConfigFile):
133
144
  "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
134
145
  }
135
146
  )
147
+ steps.append(cls.get_setup_git_step())
136
148
  steps.append(
137
149
  {
138
150
  "name": "Setup Python",
@@ -162,8 +174,8 @@ class Workflow(YamlConfigFile):
162
174
  """Get the release steps."""
163
175
  return [
164
176
  {
165
- "name": "Create and Push Tag",
166
- "run": f"git tag {cls.get_version()} && git push origin {cls.get_version()}", # noqa: E501
177
+ "name": "Tag and Push",
178
+ "run": f"git push && git tag {cls.get_version()} && git push origin {cls.get_version()}", # noqa: E501
167
179
  },
168
180
  {
169
181
  "name": "Build Changelog",
@@ -212,12 +224,20 @@ class Workflow(YamlConfigFile):
212
224
  step["env"] = {"REPO_TOKEN": cls.get_repo_token()}
213
225
  return step
214
226
 
227
+ @classmethod
228
+ def get_setup_git_step(cls) -> dict[str, Any]:
229
+ """Get the setup git step."""
230
+ return {
231
+ "name": "Setup Git",
232
+ "run": 'git config --global user.email "github-actions[bot]@users.noreply.github.com" && git config --global user.name "github-actions[bot]"', # noqa: E501
233
+ }
234
+
215
235
  @classmethod
216
236
  def get_commit_step(cls) -> dict[str, Any]:
217
237
  """Get the commit step."""
218
238
  return {
219
- "name": "Commit Changes",
220
- "run": "poetry run git commit --no-verify -m 'CI/CD: Committing possible changes to pyproject.toml and poetry.lock' && poetry run git push", # noqa: E501
239
+ "name": "Commit added changes",
240
+ "run": "git commit --no-verify -m '[skip ci] CI/CD: Committing possible added changes (e.g.: pyproject.toml and poetry.lock)'", # noqa: E501
221
241
  }
222
242
 
223
243
  @classmethod
@@ -45,10 +45,12 @@ class HealthCheckWorkflow(Workflow):
45
45
  *(
46
46
  cls.get_poetry_setup_steps(
47
47
  install_dependencies=True,
48
+ token=True,
48
49
  )
49
50
  ),
50
51
  cls.get_protect_repository_step(),
51
52
  cls.get_pre_commit_step(),
53
+ cls.get_commit_step(),
52
54
  cls.get_extract_version_step(),
53
55
  ],
54
56
  ),
@@ -33,9 +33,9 @@ class ReleaseWorkflow(HealthCheckWorkflow):
33
33
  @classmethod
34
34
  def get_permissions(cls) -> dict[str, Any]:
35
35
  """Get the workflow permissions."""
36
- return {
37
- "contents": "write",
38
- }
36
+ permissions = super().get_permissions()
37
+ permissions["contents"] = "write"
38
+ return permissions
39
39
 
40
40
  @classmethod
41
41
  def get_jobs(cls) -> dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: winipedia-utils
3
- Version: 0.4.12
3
+ Version: 0.4.20
4
4
  Summary: A package with many utility functions
5
5
  License-Expression: MIT
6
6
  License-File: LICENSE
@@ -68,7 +68,7 @@ A comprehensive Python utility package that enforces best practices, automates p
68
68
  ```bash
69
69
  # 1: Create a new repository on GitHub
70
70
  # The default branch must be called main
71
- # add a PAT or Fine-Grained Access Token to your repo secrets called REPO_TOKEN that has write access to the repository (needed for branch protection in health_check.yaml - see winipedia_utils.git.github.repo.protect)
71
+ # add a PAT or Fine-Grained Access Token to your repo secrets called REPO_TOKEN that has write access to the repository (Adminstration and Contents)(needed for branch protection in health_check.yaml - see winipedia_utils.git.github.repo.protect and for commiting as an action in release.yaml)
72
72
 
73
73
  # 2: Clone the repository
74
74
  git clone https://github.com/owner/repo.git
@@ -15,10 +15,10 @@ winipedia_utils/git/github/repo/protect.py,sha256=WW8nkIp8DND_b3UJ9xUzucHmQOH0KZ
15
15
  winipedia_utils/git/github/repo/repo.py,sha256=OqoOfqDhe_Iik71dNqi4h3fGrMno33hSjk0bpNg3eZk,7865
16
16
  winipedia_utils/git/github/workflows/__init__.py,sha256=BPdntTwFEyBMJ6MyT7gddPHswvRdH9tsRtfK72VSV7Y,57
17
17
  winipedia_utils/git/github/workflows/base/__init__.py,sha256=XHsbmjiaGom-KX-S3leCY9cJD3aP9p_0X6xYMcdkHBU,23
18
- winipedia_utils/git/github/workflows/base/base.py,sha256=5ro19RTzOlp2XlmhnrOKPkPHPlzcaxoz-WbFjJtnldI,8881
19
- winipedia_utils/git/github/workflows/health_check.py,sha256=LktxE23DpPKspnO4Z-iy9B1JwQMTqPmzlX00KeQ-aq4,1484
18
+ winipedia_utils/git/github/workflows/base/base.py,sha256=6QyRPUHaTjHOLcA3Le2qffcMEzjvI0wZMOc9y2MIGr0,9575
19
+ winipedia_utils/git/github/workflows/health_check.py,sha256=cPjSJxNy9h0bKNK69crmcERACx4VGR2XytyZ1JM_wMQ,1567
20
20
  winipedia_utils/git/github/workflows/publish.py,sha256=TPbSp5QH2vVl55UdqE_kjf1HIkdubcgqWlkLjWFX5EA,1378
21
- winipedia_utils/git/github/workflows/release.py,sha256=bsv0dXEHIc_xYoORM9KM35HgGZ4HvpgGUhKhgh13AIQ,1244
21
+ winipedia_utils/git/github/workflows/release.py,sha256=hnMT12J17LmFpPCTzva-lW95MOFDQ-1bAOrTVCxeaR8,1301
22
22
  winipedia_utils/git/gitignore/__init__.py,sha256=k-2E26JaZPkF69UUOJkpQl8T_PudrC7EYCIOxwgIQVU,57
23
23
  winipedia_utils/git/gitignore/config.py,sha256=afLJI77SWLuwGOzsQGYV-94NsR6HJQFgYpvumzvpCX8,2529
24
24
  winipedia_utils/git/gitignore/gitignore.py,sha256=uE2MdynWgQuTG-y2YLR0FU5_giSE7s_TqSVQ6vnNOf8,2419
@@ -87,7 +87,7 @@ winipedia_utils/testing/tests/conftest.py,sha256=BLgUJtLecOwuEsIyJ__0buqovd5AhiG
87
87
  winipedia_utils/text/__init__.py,sha256=j2bwtK6kyeHI6SnoBjpRju0C1W2n2paXBDlNjNtaUxA,48
88
88
  winipedia_utils/text/config.py,sha256=gO-gOTQT2k1KmQ16hYOuBhSX1t8FhMP9CoSc4sFaq5o,6187
89
89
  winipedia_utils/text/string.py,sha256=yXmwOab5hXyVQG1NwlWDpy2prj0U7Vb2F5HKLT2Y77Q,3382
90
- winipedia_utils-0.4.12.dist-info/METADATA,sha256=1O05AR1Bx5l7vzlH2pbJSaG61Ig0RxzzhBxO9lPBVIU,10980
91
- winipedia_utils-0.4.12.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
92
- winipedia_utils-0.4.12.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
93
- winipedia_utils-0.4.12.dist-info/RECORD,,
90
+ winipedia_utils-0.4.20.dist-info/METADATA,sha256=ciTaUMEAge2LRU9WOhwY6NKS1yC0CKwELu3MApgKMBU,11055
91
+ winipedia_utils-0.4.20.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
92
+ winipedia_utils-0.4.20.dist-info/licenses/LICENSE,sha256=o316mE2gGzd__JT69p7S_zlOmKiHh8YjpImCCcWyTvM,1066
93
+ winipedia_utils-0.4.20.dist-info/RECORD,,