dycw-actions 0.7.7__py3-none-any.whl → 0.8.5__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.
@@ -1,6 +1,6 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typed_settings import load_settings, option, settings
3
+ from typed_settings import Secret, load_settings, option, secret, settings
4
4
 
5
5
  from actions.pre_commit.conformalize_repo.constants import RUN_VERSION_BUMP
6
6
  from actions.utilities import LOADER
@@ -8,47 +8,53 @@ from actions.utilities import LOADER
8
8
 
9
9
  @settings
10
10
  class Settings:
11
- coverage: bool = option(default=False, help="Set up '.coveragerc.toml'")
12
- description: str | None = option(default=None, help="Repo description")
13
- envrc: bool = option(default=False, help="Set up '.envrc'")
14
- envrc__uv: bool = option(default=False, help="Set up '.envrc' with uv")
15
- envrc__uv__native_tls: bool = option(
16
- default=False, help="Set up '.envrc' with uv native TLS"
11
+ ci__ca_certificates: bool = option(
12
+ default=False, help="Update CA certficates before each step"
13
+ )
14
+ ci__gitea: bool = option(default=False, help="Set up CI on Gitea")
15
+ ci__token: str | None = option(default=None, help="Set up CI with this token")
16
+ ci__pull_request__pre_commit: bool = option(
17
+ default=False, help="Set up CI 'pull-request.yaml' pre-commit"
17
18
  )
18
- github__pull_request__pre_commit: bool = option(
19
- default=False, help="Set up 'pull-request.yaml' pre-commit"
19
+ ci__pull_request__pyright: bool = option(
20
+ default=False, help="Set up CI 'pull-request.yaml' pyright"
20
21
  )
21
- github__pull_request__pre_commit__gitea: bool = option(
22
- default=False, help="Set up 'pull-request.yaml' for Gitea"
22
+ ci__pull_request__pytest__macos: bool = option(
23
+ default=False, help="Set up CI 'pull-request.yaml' pytest with MacOS"
23
24
  )
24
- github__pull_request__pyright: bool = option(
25
- default=False, help="Set up 'pull-request.yaml' pyright"
25
+ ci__pull_request__pytest__ubuntu: bool = option(
26
+ default=False, help="Set up CI 'pull-request.yaml' pytest with Ubuntu"
26
27
  )
27
- github__pull_request__pytest__macos: bool = option(
28
- default=False, help="Set up 'pull-request.yaml' pytest with MacOS"
28
+ ci__pull_request__pytest__windows: bool = option(
29
+ default=False, help="Set up CI 'pull-request.yaml' pytest with Windows"
29
30
  )
30
- github__pull_request__pytest__ubuntu: bool = option(
31
- default=False, help="Set up 'pull-request.yaml' pytest with Ubuntu"
31
+ ci__pull_request__pytest__sops_age_key: str | None = option(
32
+ default=None,
33
+ help="Set up CI 'pull-request.yaml' pytest with this 'age' key for 'sops'",
32
34
  )
33
- github__pull_request__pytest__windows: bool = option(
34
- default=False, help="Set up 'pull-request.yaml' pytest with Windows"
35
+ ci__pull_request__ruff: bool = option(
36
+ default=False, help="Set up CI 'pull-request.yaml' ruff"
35
37
  )
36
- github__pull_request__ruff: bool = option(
37
- default=False, help="Set up 'pull-request.yaml' ruff"
38
+ ci__push__publish: bool = option(
39
+ default=False, help="Set up CI 'push.yaml' publishing"
38
40
  )
39
- github__push__publish: bool = option(
40
- default=False, help="Set up 'push.yaml' publishing"
41
+ ci__push__publish__username: str | None = option(
42
+ default=None, help="Set up CI 'push.yaml' publishing with this username"
41
43
  )
42
- github__push__tag: bool = option(default=False, help="Set up 'push.yaml' tagging")
43
- github__push__tag__major: bool = option(
44
- default=False, help="Set up 'push.yaml' with the 'major' tag"
44
+ ci__push__publish__password: Secret[str] | None = secret(
45
+ default=None, help="Set up CI 'push.yaml' publishing with this password"
45
46
  )
46
- github__push__tag__major_minor: bool = option(
47
- default=False, help="Set up 'push.yaml' with the 'major.minor' tag"
47
+ ci__push__publish__publish_url: Secret[str] | None = secret(
48
+ default=None, help="Set up CI 'push.yaml' publishing with this URL"
48
49
  )
49
- github__push__tag__latest: bool = option(
50
- default=False, help="Set up 'push.yaml' tagging"
50
+ ci__push__tag: bool = option(default=False, help="Set up CI 'push.yaml' tagging")
51
+ ci__push__tag__all: bool = option(
52
+ default=False, help="Set up CI 'push.yaml' tagging with all tags"
51
53
  )
54
+ coverage: bool = option(default=False, help="Set up '.coveragerc.toml'")
55
+ description: str | None = option(default=None, help="Repo description")
56
+ envrc: bool = option(default=False, help="Set up '.envrc'")
57
+ envrc__uv: bool = option(default=False, help="Set up '.envrc' with uv")
52
58
  gitignore: bool = option(default=False, help="Set up '.gitignore'")
53
59
  package_name: str | None = option(default=None, help="Package name")
54
60
  pre_commit__dockerfmt: bool = option(
@@ -72,9 +78,6 @@ class Settings:
72
78
  pre_commit__uv: bool = option(
73
79
  default=False, help="Set up '.pre-commit-config.yaml' uv"
74
80
  )
75
- pre_commit__uv__script: str | None = option(
76
- default=None, help="Set up '.pre-commit-config.yaml' uv lock script"
77
- )
78
81
  pyproject: bool = option(default=False, help="Set up 'pyproject.toml'")
79
82
  pyproject__project__optional_dependencies__scripts: bool = option(
80
83
  default=False,
@@ -100,6 +103,7 @@ class Settings:
100
103
  repo_name: str | None = option(default=None, help="Repo name")
101
104
  ruff: bool = option(default=False, help="Set up 'ruff.toml'")
102
105
  run_version_bump: bool = option(default=RUN_VERSION_BUMP, help="Run version bump")
106
+ uv__native_tls: bool = option(default=False, help="Setup 'uv' with native TLS")
103
107
  script: str | None = option(
104
108
  default=None, help="Set up a script instead of a package"
105
109
  )
@@ -27,10 +27,9 @@ if TYPE_CHECKING:
27
27
  from pathlib import Path
28
28
 
29
29
  from utilities.packaging import Requirement
30
- from utilities.types import PathLike
30
+ from utilities.types import PathLike, StrDict
31
31
 
32
32
  from actions.pre_commit.update_requirements.classes import Version2or3, VersionSet
33
- from actions.types import StrDict
34
33
 
35
34
 
36
35
  def update_requirements(*paths: PathLike) -> None:
@@ -15,19 +15,18 @@ from tomlkit.items import AoT, Array, Table
15
15
  from utilities.functions import ensure_class, ensure_str
16
16
  from utilities.iterables import OneEmptyError, OneNonUniqueError, one
17
17
  from utilities.packaging import Requirement
18
- from utilities.types import PathLike
18
+ from utilities.types import PathLike, StrDict
19
19
 
20
20
  from actions.constants import YAML_INSTANCE
21
21
  from actions.logging import LOGGER
22
- from actions.types import StrDict
23
22
  from actions.utilities import are_equal_modulo_new_line, write_text, yaml_dump
24
23
 
25
24
  if TYPE_CHECKING:
26
25
  from collections.abc import Callable, Iterable, Iterator, MutableSet
27
26
 
28
- from utilities.types import PathLike
27
+ from utilities.types import PathLike, StrDict
29
28
 
30
- from actions.types import FuncRequirement, HasAppend, HasSetDefault, StrDict
29
+ from actions.types import FuncRequirement, HasAppend, HasSetDefault
31
30
 
32
31
 
33
32
  def ensure_aot_contains(array: AoT, /, *tables: Table) -> None:
@@ -7,7 +7,7 @@ from typing import TYPE_CHECKING
7
7
 
8
8
  from requests import get
9
9
  from utilities.atomicwrites import writer
10
- from utilities.subprocess import chmod, run, ssh
10
+ from utilities.subprocess import chmod, ssh
11
11
  from utilities.text import strip_and_dedent
12
12
 
13
13
  from actions import __version__
@@ -19,6 +19,7 @@ from actions.register_gitea_runner.constants import (
19
19
  URL_WAIT_FOR_IT,
20
20
  )
21
21
  from actions.register_gitea_runner.settings import SETTINGS
22
+ from actions.utilities import logged_run
22
23
 
23
24
  if TYPE_CHECKING:
24
25
  from utilities.types import PathLike
@@ -71,6 +72,7 @@ def register_gitea_runner(
71
72
  *_docker_exec_generate(user=gitea_container_user, name=gitea_container_name),
72
73
  return_=True,
73
74
  )
75
+ LOGGER.info("Got token %r", token)
74
76
  _start_runner(
75
77
  token,
76
78
  runner_certificate=runner_certificate,
@@ -95,10 +97,9 @@ def register_against_local(
95
97
  ) -> None:
96
98
  """Register against a local instance of Gitea."""
97
99
  LOGGER.info("Registering against %s:%d...", gitea_host, gitea_port)
98
- token = run(
100
+ token = logged_run(
99
101
  *_docker_exec_generate(user=gitea_container_user, name=gitea_container_name),
100
102
  return_=True,
101
- logger=LOGGER,
102
103
  )
103
104
  _start_runner(
104
105
  token,
@@ -236,10 +237,8 @@ def _start_runner(
236
237
  _write_config(token, capacity=runner_capacity, certificate=runner_certificate)
237
238
  _write_entrypoint(host=gitea_host, port=gitea_port)
238
239
  _write_wait_for_it()
239
- run(
240
- *_docker_stop_runner_args(name=runner_container_name), print=True, logger=LOGGER
241
- )
242
- run(
240
+ logged_run(*_docker_stop_runner_args(name=runner_container_name), print=True)
241
+ logged_run(
243
242
  *_docker_run_act_runner_args(
244
243
  token,
245
244
  host=gitea_host,
@@ -249,7 +248,6 @@ def _start_runner(
249
248
  container_name=runner_container_name,
250
249
  ),
251
250
  print=True,
252
- logger=LOGGER,
253
251
  )
254
252
 
255
253
 
actions/run_hooks/lib.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  import time
4
+ from contextlib import suppress
4
5
  from pathlib import Path
5
6
  from re import search
6
7
  from subprocess import CalledProcessError
@@ -24,24 +25,27 @@ def run_hooks(
24
25
  *,
25
26
  repos: list[str] | None = SETTINGS.repos,
26
27
  hooks: list[str] | None = SETTINGS.hooks,
28
+ hooks_exclude: list[str] | None = SETTINGS.hooks_exclude,
27
29
  sleep: int = SETTINGS.sleep,
28
30
  ) -> None:
29
31
  LOGGER.info(
30
32
  strip_and_dedent("""
31
33
  Running '%s' (version %s) with settings:
32
- - repos = %s
33
- - hooks = %s
34
- - sleep = %d
34
+ - repos = %s
35
+ - hooks = %s
36
+ - hooks_exclude = %s
37
+ - sleep = %d
35
38
  """),
36
39
  run_hooks.__name__,
37
40
  __version__,
38
41
  repos,
39
42
  hooks,
43
+ hooks_exclude,
40
44
  sleep,
41
45
  )
42
46
  results = {
43
47
  hook: _run_hook(hook, sleep=sleep)
44
- for hook in _yield_hooks(repos=repos, hooks=hooks)
48
+ for hook in _yield_hooks(repos=repos, hooks=hooks, hooks_exclude=hooks_exclude)
45
49
  }
46
50
  failed = {hook: result for hook, result in results.items() if not result}
47
51
  if len(failed) >= 1:
@@ -53,6 +57,7 @@ def _yield_hooks(
53
57
  *,
54
58
  repos: list[str] | None = SETTINGS.repos,
55
59
  hooks: list[str] | None = SETTINGS.hooks,
60
+ hooks_exclude: list[str] | None = SETTINGS.hooks_exclude,
56
61
  ) -> Iterator[str]:
57
62
  dict_ = safe_load(Path(".pre-commit-config.yaml").read_text())
58
63
  repos_list = ensure_class(dict_["repos"], list)
@@ -65,6 +70,10 @@ def _yield_hooks(
65
70
  for hook in _yield_repo_hooks(repo):
66
71
  if any(search(hook_i, hook) for hook_i in hooks):
67
72
  results.add(hook)
73
+ if hooks_exclude is not None:
74
+ for hook in hooks_exclude:
75
+ with suppress(KeyError):
76
+ results.remove(hook)
68
77
  yield from sorted(results)
69
78
 
70
79
 
@@ -15,6 +15,9 @@ class Settings:
15
15
  hooks: list[str] | None = option(
16
16
  default=None, converter=convert_list_strs, help="The hooks to be run"
17
17
  )
18
+ hooks_exclude: list[str] | None = option(
19
+ default=None, converter=convert_list_strs, help="The hooks not to be run"
20
+ )
18
21
  sleep: int = option(default=1, help="Sleep in between runs")
19
22
 
20
23
 
actions/types.py CHANGED
@@ -6,6 +6,7 @@ from typing import TYPE_CHECKING, Any
6
6
  from tomlkit.items import Array, Table
7
7
  from typed_settings import Secret
8
8
  from utilities.packaging import Requirement
9
+ from utilities.types import StrDict
9
10
 
10
11
  if TYPE_CHECKING:
11
12
  from tomlkit.container import Container
@@ -15,7 +16,6 @@ type FuncRequirement = Callable[[Requirement], Requirement]
15
16
  type HasAppend = Array | list[Any]
16
17
  type HasSetDefault = Container | StrDict | Table
17
18
  type SecretLike = str | Secret[str]
18
- type StrDict = dict[str, Any]
19
19
 
20
20
 
21
- __all__ = ["FuncRequirement", "HasAppend", "HasSetDefault", "SecretLike", "StrDict"]
21
+ __all__ = ["FuncRequirement", "HasAppend", "HasSetDefault", "SecretLike"]
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dycw-actions
3
- Version: 0.7.7
3
+ Version: 0.8.5
4
4
  Summary: Library of actions
5
5
  Requires-Dist: click>=8.3.1,<9
6
- Requires-Dist: dycw-utilities>=0.178.0,<1
6
+ Requires-Dist: dycw-utilities>=0.179.0,<1
7
7
  Requires-Dist: inflect>=7.5.0,<8
8
8
  Requires-Dist: libcst>=1.8.6,<2
9
9
  Requires-Dist: packaging>=25.0,<26
@@ -1,23 +1,21 @@
1
- actions/__init__.py,sha256=trsIPKwrk3xNHIWvYXX9uhHoJTOvGbfIIBQNFcFa_Js,58
2
- actions/action_dicts/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
3
- actions/action_dicts/constants.py,sha256=tYYLr3aRRRvnR6NSADOJMN-B6gtqg2A9gBuheEPyGy4,189
4
- actions/action_dicts/lib.py,sha256=MpK_y5Jao0-3p6bWeYX5QQy3-JjMxwyzXRU5LjO25Iw,5547
1
+ actions/__init__.py,sha256=OlKKXmurpRa7hpnMwsqC-3AVjanBWghNU3iQC6jDLXg,58
5
2
  actions/clean_dir/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
6
3
  actions/clean_dir/cli.py,sha256=OrFA2nEN2LyGF22mhTNEBr7KSuKgX54sGy9RyE73qUc,569
7
4
  actions/clean_dir/constants.py,sha256=aDNaYtemEv3lcMXo96Oh4pw_HASMby1GZC1D_gbjPAc,167
8
5
  actions/clean_dir/lib.py,sha256=7_-QbvB9Bq2veEl4eYWkBBWN0jSNrjGVlx1gLWS1PwU,1606
9
6
  actions/clean_dir/settings.py,sha256=mqM0Oq-yz4dXKcUi3JmOCvDhoeBNQm_Qe70cGmhdcQE,345
10
7
  actions/cli.py,sha256=J9k7_BQzgDHdgzkTqwXVzncRMHm0eAT0WW_c_gAUFlE,4441
11
- actions/constants.py,sha256=DgcgYPL3l2lAMIVRi7LzB_YsD0H8WDhaMphh5ztRD54,445
8
+ actions/constants.py,sha256=C_eTTPwNJRjXV5BkFqdHMC2yQW86-iNTOCZjHYkMix0,1776
12
9
  actions/logging.py,sha256=rMTcQMGndUHTCaXXtyOHt_VXUMhQGRHoN7okpoX0y5I,120
13
10
  actions/pre_commit/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
14
11
  actions/pre_commit/click.py,sha256=BLHjkO0gIW7rgLabuWnszwXmI4yb8Li5D8gt81GR-FQ,270
15
12
  actions/pre_commit/conformalize_repo/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
16
- actions/pre_commit/conformalize_repo/cli.py,sha256=rPrxobdo4sKnq0de_UWDtrHqlhF6GTAabRhw_1XBeZY,3063
13
+ actions/pre_commit/conformalize_repo/action_dicts.py,sha256=6KVL5xeQ8fSAjPpgRnDmKV9lsqqJJND7VvHNBqMgjs8,7605
14
+ actions/pre_commit/conformalize_repo/cli.py,sha256=1og2QndEIvOgub_az3Nk3KOLWSaae6eARpBMw22eUu4,2891
17
15
  actions/pre_commit/conformalize_repo/configs/gitignore,sha256=8YCRPwysCD8-67yFXaTg6O8TTl4xeNIh7_DVmaU5Ix0,5063
18
- actions/pre_commit/conformalize_repo/constants.py,sha256=7WMbc1BwkVPJIf3eh3MaCoWj5A7pSPvNic28nrFTcoA,2148
19
- actions/pre_commit/conformalize_repo/lib.py,sha256=cdEggEXiDTt2QHbzP0rIViFriPoaApf3XcGeAo-hiHY,48020
20
- actions/pre_commit/conformalize_repo/settings.py,sha256=Oz2AeStS64DFzT1HKJ888_7tiU1TdJIGBarvyKYfp4E,4985
16
+ actions/pre_commit/conformalize_repo/constants.py,sha256=s96CbNkfghrxQSJSWSOGuqWs-XjpwLyJBwKDlb-YdUY,1136
17
+ actions/pre_commit/conformalize_repo/lib.py,sha256=ur2gDK3MwB5Vnb6Zb33alXobgN55tQgECkjd9AfXpfU,50348
18
+ actions/pre_commit/conformalize_repo/settings.py,sha256=SDP34Ux75Db1MEsHpXx52bEJuqA03xKTYulJX1wvl4g,5338
21
19
  actions/pre_commit/constants.py,sha256=NBJ5GBMg5qhMAhAfxx1FKw0CdPwW_wG2cUJJ0dkF5HE,158
22
20
  actions/pre_commit/format_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
23
21
  actions/pre_commit/format_requirements/cli.py,sha256=c9UdOFDLEei5AEzrVvo6FopIEOf2EqyOliA-bOR5a2o,584
@@ -39,8 +37,8 @@ actions/pre_commit/update_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFB
39
37
  actions/pre_commit/update_requirements/classes.py,sha256=ERC70c1CxQ3rOsQaEtp6FGbK_VaJ4K0jAV5XTB5-L30,3486
40
38
  actions/pre_commit/update_requirements/cli.py,sha256=CBfm8M7hwSRw8KS6ttiNE86IFHJ52V42AxlfakqTDN0,584
41
39
  actions/pre_commit/update_requirements/constants.py,sha256=ve44_RYed_41ckgQNPkb08u7Y1cpLpzutGSL9FdGBF8,228
42
- actions/pre_commit/update_requirements/lib.py,sha256=akSmdqFpDS8ETsdGs4-8lfoKOp_8bBlKyKUXhUlrzpg,4619
43
- actions/pre_commit/utilities.py,sha256=L1HCi3l778REPfomMuYbxrrnCn0FDRFaWAfmFR0lsTY,11422
40
+ actions/pre_commit/update_requirements/lib.py,sha256=Wh8Lq6s_YJv4sDoUUMB-HuP0Ysm9nHePX7_xZ81o7Pk,4590
41
+ actions/pre_commit/utilities.py,sha256=VLh2tC9NNI60Uwx-ze3uuqKgOJ1OvFCvzYjDWM5o0Js,11397
44
42
  actions/publish_package/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
45
43
  actions/publish_package/cli.py,sha256=nAPHCq67mxUb3yHepVGcoQ69qgaQahM1-cxdbHfxQg0,803
46
44
  actions/publish_package/constants.py,sha256=C68ZCVL_jVlYdLGpOK6saZccWoFy5AmC_NMBIWYdYOE,209
@@ -57,13 +55,13 @@ actions/register_gitea_runner/cli.py,sha256=70RUyzKCZHxyDRMFwCAwDC0LDsUZxBi2T6ct
57
55
  actions/register_gitea_runner/configs/config.yml,sha256=0kpaqAjMRDqdSxkSK8ydOk2IsrlkB4cUkYmbkHAurrg,5683
58
56
  actions/register_gitea_runner/configs/entrypoint.sh,sha256=IN40hAu8ufyyFWPIgsX_hWp0ZZZ0c36czCaqmECjBrw,476
59
57
  actions/register_gitea_runner/constants.py,sha256=wX1f5qvhIXngBVWbIQRoIaXIdPaUByvG8HS8P0WcCGM,694
60
- actions/register_gitea_runner/lib.py,sha256=V_K6UHmZOD9V-DF6ZNA2QakNyuyuyjgJZ6AJQFf37lQ,8832
58
+ actions/register_gitea_runner/lib.py,sha256=ouc5XGfFRnAQNzU238U0_oVTdmdGEIrOW8lggqXsogM,8853
61
59
  actions/register_gitea_runner/settings.py,sha256=0UQm8M3qDiBE3jiE333M4FdLjikNAzpc9gk_VlzI0s8,1149
62
60
  actions/run_hooks/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
63
61
  actions/run_hooks/cli.py,sha256=xKBw6iIlHpUlHl6-QWQLSL6KKVjnsihBeJ7h58Rl8P4,616
64
62
  actions/run_hooks/constants.py,sha256=JRhDk08qbzo5C-zwHdXZV5ajvNSKh4GcOcBvOIY6IGU,172
65
- actions/run_hooks/lib.py,sha256=a-eUOtgTouxJYCsLRjsPIXl6nP58T2RB4jhr-Hhz0Sg,2850
66
- actions/run_hooks/settings.py,sha256=XbQe1j1oEvDnbl4H6B-YEY6Ms6qlsj-N2XSJhdVHCWA,606
63
+ actions/run_hooks/lib.py,sha256=_IXK6uzKpXyyky6D0oYLjXoRLHsbA1pvTk_bcdY26RU,3259
64
+ actions/run_hooks/settings.py,sha256=Cj6QVK6JspzOp6-1CaOENlXbg25kvgPXG4FKWgIiDgY,740
67
65
  actions/setup_cronjob/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
68
66
  actions/setup_cronjob/cli.py,sha256=l6t2WjCUprACV0rY8kHvpHLt3LgMI4q2XY4AEOiutkk,891
69
67
  actions/setup_cronjob/configs/cron.tmpl,sha256=UD_d0LYlB6tbkXAcUTzpGDWVNgIhCR45Jgky91iSCP8,412
@@ -76,9 +74,9 @@ actions/tag_commit/cli.py,sha256=1E6cM0XKTCt_Ukb7pxqOojHpJjoa63dVBO6DXoESe9Q,745
76
74
  actions/tag_commit/constants.py,sha256=ceOvQpY4dgtJSd7v_jI1V00S0SjRq2ToGeZu41-DL7M,176
77
75
  actions/tag_commit/lib.py,sha256=rq1SqAkNp98cPsNOsFY4F1D6nNi7N3wqVbFPno8lsuI,1849
78
76
  actions/tag_commit/settings.py,sha256=TOeKG_GODP--2lBSyGzH_M32jDIfh4vk_Ts06R3_ak4,629
79
- actions/types.py,sha256=GRXLoJtYWmRjgfatDDRMcXKZkN9ZtK1Fi2MEyAZ84uk,591
77
+ actions/types.py,sha256=1P3oAnYxyKgAfv8986jZ6whwdHV0qLHoX0oR8brviQk,586
80
78
  actions/utilities.py,sha256=VpFLBiAezgSRlm9dvnyPyQohreaV2Lv7cJ9HAxqZ4WI,4086
81
- dycw_actions-0.7.7.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
82
- dycw_actions-0.7.7.dist-info/entry_points.txt,sha256=2Uu7wAZOm0mmcsGBEsGB370HAWgVWECRFJ9rKgfC3-I,46
83
- dycw_actions-0.7.7.dist-info/METADATA,sha256=CORF-XquPdSrUKd4Doo9mV0OA8RmDHzyWwZUMXgtC8E,654
84
- dycw_actions-0.7.7.dist-info/RECORD,,
79
+ dycw_actions-0.8.5.dist-info/WHEEL,sha256=KSLUh82mDPEPk0Bx0ScXlWL64bc8KmzIPNcpQZFV-6E,79
80
+ dycw_actions-0.8.5.dist-info/entry_points.txt,sha256=2Uu7wAZOm0mmcsGBEsGB370HAWgVWECRFJ9rKgfC3-I,46
81
+ dycw_actions-0.8.5.dist-info/METADATA,sha256=_wo_GxdFbHJzLCgdaBRLKBe-TwFpIuQZ9e0MyWHptUY,654
82
+ dycw_actions-0.8.5.dist-info/RECORD,,
@@ -1 +0,0 @@
1
- from __future__ import annotations
@@ -1,8 +0,0 @@
1
- from __future__ import annotations
2
-
3
- GITHUB_TOKEN = "${{github.token}}" # noqa: S105
4
- PRERELEASE = "disallow"
5
- RESOLUTION = "highest"
6
-
7
-
8
- __all__ = ["GITHUB_TOKEN", "PRERELEASE", "RESOLUTION"]
@@ -1,186 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import TYPE_CHECKING, Any
4
-
5
- from actions.action_dicts.constants import GITHUB_TOKEN, PRERELEASE, RESOLUTION
6
- from actions.publish_package.constants import PUBLISH_PACKAGE_DOCSTRING
7
- from actions.random_sleep.constants import RANDOM_SLEEP_DOCSTRING
8
- from actions.run_hooks.constants import RUN_HOOKS_DOCSTRING
9
- from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING
10
-
11
- if TYPE_CHECKING:
12
- from actions.types import StrDict
13
-
14
-
15
- def run_action_pre_commit_dict(
16
- *,
17
- token: str = GITHUB_TOKEN,
18
- submodules: str | None = None,
19
- repos: Any | None = None,
20
- hooks: Any | None = None,
21
- sleep: int = 1,
22
- gitea: bool = False,
23
- ) -> StrDict:
24
- dict_: StrDict = {"token": token}
25
- _add_item(dict_, "submodules", value=submodules)
26
- _add_item(dict_, "repos", value=repos)
27
- _add_item(dict_, "hooks", value=hooks)
28
- dict_["sleep"] = sleep
29
- return {
30
- "if": f"{_runner(gitea=gitea)}.event_name == 'pull_request'",
31
- "name": RUN_HOOKS_DOCSTRING,
32
- "uses": "dycw/action-run-hooks@latest",
33
- "with": dict_,
34
- }
35
-
36
-
37
- def run_action_publish_dict(
38
- *,
39
- token: str = GITHUB_TOKEN,
40
- username: str | None = None,
41
- password: str | None = None,
42
- publish_url: str | None = None,
43
- trusted_publishing: bool = False,
44
- native_tls: bool = False,
45
- ) -> StrDict:
46
- dict_: StrDict = {"token": token}
47
- _add_item(dict_, "username", value=username)
48
- _add_item(dict_, "password", value=password)
49
- _add_item(dict_, "publish-url", value=publish_url)
50
- _add_boolean(dict_, "trusted-publishing", value=trusted_publishing)
51
- _add_native_tls(dict_, native_tls=native_tls)
52
- return {
53
- "name": PUBLISH_PACKAGE_DOCSTRING,
54
- "uses": "dycw/action-publish-package@latest",
55
- "with": dict_,
56
- }
57
-
58
-
59
- def run_action_pyright_dict(
60
- *,
61
- token: str = GITHUB_TOKEN,
62
- python_version: str | None = None,
63
- resolution: str = RESOLUTION,
64
- prerelease: str = PRERELEASE,
65
- native_tls: bool = False,
66
- with_requirements: str | None = None,
67
- ) -> StrDict:
68
- dict_: StrDict = {"token": token}
69
- _add_python_version(dict_, python_version=python_version)
70
- dict_["resolution"] = resolution
71
- dict_["prerelease"] = prerelease
72
- _add_native_tls(dict_, native_tls=native_tls)
73
- _add_with_requirements(dict_, with_requirements=with_requirements)
74
- return {
75
- "name": "Run 'pyright'",
76
- "uses": "dycw/action-pyright@latest",
77
- "with": dict_,
78
- }
79
-
80
-
81
- def run_action_pytest_dict(
82
- *,
83
- token: str = GITHUB_TOKEN,
84
- python_version: str | None = None,
85
- sops_age_key: str | None = None,
86
- resolution: str = RESOLUTION,
87
- prerelease: str = PRERELEASE,
88
- native_tls: bool = False,
89
- with_requirements: str | None = None,
90
- ) -> StrDict:
91
- dict_: StrDict = {"token": token}
92
- _add_python_version(dict_, python_version=python_version)
93
- _add_item(dict_, "sops-age-key", value=sops_age_key)
94
- dict_["resolution"] = resolution
95
- dict_["prerelease"] = prerelease
96
- _add_native_tls(dict_, native_tls=native_tls)
97
- _add_with_requirements(dict_, with_requirements=with_requirements)
98
- return {"name": "Run 'pytest'", "uses": "dycw/action-pytest@latest", "with": dict_}
99
-
100
-
101
- def run_action_random_sleep_dict(
102
- *,
103
- token: str = GITHUB_TOKEN,
104
- min: int = 0, # noqa: A002
105
- max: int = 3600, # noqa: A002
106
- step: int = 1,
107
- log_freq: int = 1,
108
- ) -> StrDict:
109
- dict_: StrDict = {
110
- "token": token,
111
- "min": min,
112
- "max": max,
113
- "step": step,
114
- "log-freq": log_freq,
115
- }
116
- return {
117
- "name": RANDOM_SLEEP_DOCSTRING,
118
- "uses": "dycw/action-random-sleep@latest",
119
- "with": dict_,
120
- }
121
-
122
-
123
- def run_action_ruff_dict(*, token: str = GITHUB_TOKEN) -> StrDict:
124
- dict_: StrDict = {"token": token}
125
- return {"name": "Run 'ruff'", "uses": "dycw/action-ruff@latest", "with": dict_}
126
-
127
-
128
- def run_action_tag_dict(
129
- *,
130
- token: str = GITHUB_TOKEN,
131
- user_name: str = "github-actions-bot",
132
- user_email: str = "noreply@github.com",
133
- major_minor: bool = False,
134
- major: bool = False,
135
- latest: bool = False,
136
- ) -> StrDict:
137
- dict_: StrDict = {"token": token, "user-name": user_name, "user-email": user_email}
138
- _add_boolean(dict_, "major-minor", value=major_minor)
139
- _add_boolean(dict_, "major", value=major)
140
- _add_boolean(dict_, "latest", value=latest)
141
- return {
142
- "name": TAG_COMMIT_DOCSTRING,
143
- "uses": "dycw/action-tag-commit@latest",
144
- "with": dict_,
145
- }
146
-
147
-
148
- def _add_boolean(dict_: StrDict, key: str, /, *, value: bool = False) -> None:
149
- if value:
150
- dict_[key] = value
151
-
152
-
153
- def _add_item(dict_: StrDict, key: str, /, *, value: Any | None = None) -> None:
154
- if value is not None:
155
- dict_[key] = value
156
-
157
-
158
- def _add_native_tls(dict_: StrDict, /, *, native_tls: bool = False) -> None:
159
- _add_boolean(dict_, "native-tls", value=native_tls)
160
-
161
-
162
- def _add_python_version(
163
- dict_: StrDict, /, *, python_version: str | None = None
164
- ) -> None:
165
- _add_item(dict_, "python-version", value=python_version)
166
-
167
-
168
- def _add_with_requirements(
169
- dict_: StrDict, /, *, with_requirements: str | None = None
170
- ) -> None:
171
- _add_item(dict_, "with-requirements", value=with_requirements)
172
-
173
-
174
- def _runner(*, gitea: bool = False) -> str:
175
- return "gitea" if gitea else "github"
176
-
177
-
178
- __all__ = [
179
- "run_action_pre_commit_dict",
180
- "run_action_publish_dict",
181
- "run_action_pyright_dict",
182
- "run_action_pytest_dict",
183
- "run_action_random_sleep_dict",
184
- "run_action_ruff_dict",
185
- "run_action_tag_dict",
186
- ]