dycw-actions 0.7.1__py3-none-any.whl → 0.8.4__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.
Files changed (30) hide show
  1. actions/__init__.py +1 -1
  2. actions/clean_dir/lib.py +1 -0
  3. actions/cli.py +10 -0
  4. actions/constants.py +64 -1
  5. actions/pre_commit/conformalize_repo/action_dicts.py +247 -0
  6. actions/pre_commit/conformalize_repo/cli.py +14 -14
  7. actions/pre_commit/conformalize_repo/constants.py +2 -38
  8. actions/pre_commit/conformalize_repo/lib.py +317 -242
  9. actions/pre_commit/conformalize_repo/settings.py +37 -33
  10. actions/pre_commit/touch_empty_py/lib.py +9 -1
  11. actions/pre_commit/touch_py_typed/lib.py +9 -1
  12. actions/pre_commit/update_requirements/classes.py +16 -3
  13. actions/pre_commit/update_requirements/lib.py +15 -4
  14. actions/pre_commit/utilities.py +3 -4
  15. actions/register_gitea_runner/cli.py +32 -0
  16. actions/register_gitea_runner/configs/config.yml +110 -0
  17. actions/register_gitea_runner/configs/entrypoint.sh +23 -0
  18. actions/register_gitea_runner/constants.py +23 -0
  19. actions/register_gitea_runner/lib.py +289 -0
  20. actions/register_gitea_runner/settings.py +33 -0
  21. actions/run_hooks/lib.py +13 -4
  22. actions/run_hooks/settings.py +3 -0
  23. actions/types.py +2 -2
  24. {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/METADATA +4 -3
  25. {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/RECORD +28 -23
  26. actions/action_dicts/constants.py +0 -8
  27. actions/action_dicts/lib.py +0 -186
  28. /actions/{action_dicts → register_gitea_runner}/__init__.py +0 -0
  29. {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/WHEEL +0 -0
  30. {dycw_actions-0.7.1.dist-info → dycw_actions-0.8.4.dist-info}/entry_points.txt +0 -0
@@ -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
- ]