dycw-actions 0.8.11__py3-none-any.whl → 0.11.3__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.
- actions/__init__.py +1 -1
- actions/clean_dir/lib.py +7 -4
- actions/cli.py +18 -2
- actions/constants.py +2 -0
- actions/git_clone_with/__init__.py +1 -0
- actions/git_clone_with/cli.py +41 -0
- actions/git_clone_with/constants.py +7 -0
- actions/git_clone_with/lib.py +78 -0
- actions/git_clone_with/settings.py +20 -0
- actions/pre_commit/conformalize_repo/action_dicts.py +39 -40
- actions/pre_commit/conformalize_repo/cli.py +15 -3
- actions/pre_commit/conformalize_repo/constants.py +14 -0
- actions/pre_commit/conformalize_repo/lib.py +228 -117
- actions/pre_commit/conformalize_repo/settings.py +39 -13
- actions/pre_commit/format_requirements/lib.py +5 -2
- actions/pre_commit/replace_sequence_strs/lib.py +5 -2
- actions/pre_commit/touch_empty_py/lib.py +5 -2
- actions/pre_commit/touch_py_typed/lib.py +5 -2
- actions/pre_commit/update_requirements/lib.py +6 -3
- actions/publish_package/lib.py +16 -9
- actions/random_sleep/lib.py +9 -4
- actions/register_gitea_runner/configs/entrypoint.sh +8 -8
- actions/register_gitea_runner/lib.py +23 -14
- actions/run_hooks/lib.py +15 -4
- actions/setup_cronjob/lib.py +19 -13
- actions/setup_ssh_config/__init__.py +1 -0
- actions/setup_ssh_config/cli.py +17 -0
- actions/setup_ssh_config/constants.py +7 -0
- actions/setup_ssh_config/lib.py +30 -0
- actions/tag_commit/lib.py +16 -9
- actions/utilities.py +1 -16
- {dycw_actions-0.8.11.dist-info → dycw_actions-0.11.3.dist-info}/METADATA +3 -3
- {dycw_actions-0.8.11.dist-info → dycw_actions-0.11.3.dist-info}/RECORD +35 -26
- {dycw_actions-0.8.11.dist-info → dycw_actions-0.11.3.dist-info}/WHEEL +1 -1
- {dycw_actions-0.8.11.dist-info → dycw_actions-0.11.3.dist-info}/entry_points.txt +0 -0
actions/__init__.py
CHANGED
actions/clean_dir/lib.py
CHANGED
|
@@ -4,9 +4,12 @@ from pathlib import Path
|
|
|
4
4
|
from shutil import rmtree
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
|
+
from utilities.functions import get_func_name
|
|
8
|
+
from utilities.tabulate import func_param_desc
|
|
9
|
+
|
|
10
|
+
from actions import __version__
|
|
7
11
|
from actions.clean_dir.settings import SETTINGS
|
|
8
12
|
from actions.logging import LOGGER
|
|
9
|
-
from actions.utilities import log_func_call
|
|
10
13
|
|
|
11
14
|
if TYPE_CHECKING:
|
|
12
15
|
from collections.abc import Iterator
|
|
@@ -16,7 +19,7 @@ if TYPE_CHECKING:
|
|
|
16
19
|
|
|
17
20
|
def clean_dir(*, dir_: PathLike = SETTINGS.dir) -> None:
|
|
18
21
|
"""Clean a directory."""
|
|
19
|
-
LOGGER.info(
|
|
22
|
+
LOGGER.info(func_param_desc(clean_dir, __version__, f"{dir_=}"))
|
|
20
23
|
dir_ = Path(dir_)
|
|
21
24
|
if not dir_.is_dir():
|
|
22
25
|
msg = f"{str(dir_)!r} is a not a directory"
|
|
@@ -31,8 +34,8 @@ def clean_dir(*, dir_: PathLike = SETTINGS.dir) -> None:
|
|
|
31
34
|
for d in dirs:
|
|
32
35
|
rmtree(d, ignore_errors=True)
|
|
33
36
|
else:
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
break
|
|
38
|
+
LOGGER.info("Finished running %r", get_func_name(clean_dir))
|
|
36
39
|
|
|
37
40
|
|
|
38
41
|
def _yield_dirs(*, dir_: PathLike = SETTINGS.dir) -> Iterator[Path]:
|
actions/cli.py
CHANGED
|
@@ -4,7 +4,12 @@ from click import group
|
|
|
4
4
|
from utilities.click import CONTEXT_SETTINGS
|
|
5
5
|
|
|
6
6
|
from actions.clean_dir.cli import clean_dir_sub_cmd
|
|
7
|
-
from actions.clean_dir.constants import CLEAN_DIR_SUB_CMD
|
|
7
|
+
from actions.clean_dir.constants import CLEAN_DIR_DOCSTRING, CLEAN_DIR_SUB_CMD
|
|
8
|
+
from actions.git_clone_with.cli import git_clone_with_sub_cmd
|
|
9
|
+
from actions.git_clone_with.constants import (
|
|
10
|
+
GIT_CLONE_WITH_DOCSTRING,
|
|
11
|
+
GIT_CLONE_WITH_SUB_CMD,
|
|
12
|
+
)
|
|
8
13
|
from actions.pre_commit.conformalize_repo.cli import conformalize_repo_sub_cmd
|
|
9
14
|
from actions.pre_commit.conformalize_repo.constants import (
|
|
10
15
|
CONFORMALIZE_REPO_DOCSTRING,
|
|
@@ -54,6 +59,11 @@ from actions.setup_cronjob.constants import (
|
|
|
54
59
|
SETUP_CRONJOB_DOCSTRING,
|
|
55
60
|
SETUP_CRONJOB_SUB_CMD,
|
|
56
61
|
)
|
|
62
|
+
from actions.setup_ssh_config.cli import setup_ssh_config_sub_cmd
|
|
63
|
+
from actions.setup_ssh_config.constants import (
|
|
64
|
+
SETUP_SSH_CONFIG_DOCSTRING,
|
|
65
|
+
SETUP_SSH_CONFIG_SUB_CMD,
|
|
66
|
+
)
|
|
57
67
|
from actions.tag_commit.cli import tag_commit_sub_cmd
|
|
58
68
|
from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING, TAG_COMMIT_SUB_CMD
|
|
59
69
|
|
|
@@ -62,9 +72,12 @@ from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING, TAG_COMMIT_SUB_CM
|
|
|
62
72
|
def _main() -> None: ...
|
|
63
73
|
|
|
64
74
|
|
|
65
|
-
_ = _main.command(name=CLEAN_DIR_SUB_CMD, help=
|
|
75
|
+
_ = _main.command(name=CLEAN_DIR_SUB_CMD, help=CLEAN_DIR_DOCSTRING, **CONTEXT_SETTINGS)(
|
|
66
76
|
clean_dir_sub_cmd
|
|
67
77
|
)
|
|
78
|
+
_ = _main.command(
|
|
79
|
+
name=GIT_CLONE_WITH_SUB_CMD, help=GIT_CLONE_WITH_DOCSTRING, **CONTEXT_SETTINGS
|
|
80
|
+
)(git_clone_with_sub_cmd)
|
|
68
81
|
_ = _main.command(
|
|
69
82
|
name=PUBLISH_PACKAGE_SUB_CMD, help=PUBLISH_PACKAGE_DOCSTRING, **CONTEXT_SETTINGS
|
|
70
83
|
)(publish_package_sub_cmd)
|
|
@@ -82,6 +95,9 @@ _ = _main.command(
|
|
|
82
95
|
_ = _main.command(
|
|
83
96
|
name=SETUP_CRONJOB_SUB_CMD, help=SETUP_CRONJOB_DOCSTRING, **CONTEXT_SETTINGS
|
|
84
97
|
)(setup_cronjob_sub_cmd)
|
|
98
|
+
_ = _main.command(
|
|
99
|
+
name=SETUP_SSH_CONFIG_SUB_CMD, help=SETUP_SSH_CONFIG_DOCSTRING, **CONTEXT_SETTINGS
|
|
100
|
+
)(setup_ssh_config_sub_cmd)
|
|
85
101
|
_ = _main.command(
|
|
86
102
|
name=TAG_COMMIT_SUB_CMD, help=TAG_COMMIT_DOCSTRING, **CONTEXT_SETTINGS
|
|
87
103
|
)(tag_commit_sub_cmd)
|
actions/constants.py
CHANGED
|
@@ -20,6 +20,7 @@ PYPROJECT_TOML = Path("pyproject.toml")
|
|
|
20
20
|
PYRIGHTCONFIG_JSON = Path("pyrightconfig.json")
|
|
21
21
|
PYTEST_TOML = Path("pytest.toml")
|
|
22
22
|
README_MD = Path("README.md")
|
|
23
|
+
SSH = Path.home() / ".ssh"
|
|
23
24
|
RUFF_TOML = Path("ruff.toml")
|
|
24
25
|
|
|
25
26
|
|
|
@@ -65,5 +66,6 @@ __all__ = [
|
|
|
65
66
|
"PYTEST_TOML",
|
|
66
67
|
"README_MD",
|
|
67
68
|
"RUFF_TOML",
|
|
69
|
+
"SSH",
|
|
68
70
|
"YAML_INSTANCE",
|
|
69
71
|
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
import click
|
|
7
|
+
from click import argument
|
|
8
|
+
from typed_settings import click_options
|
|
9
|
+
from utilities.logging import basic_config
|
|
10
|
+
from utilities.os import is_pytest
|
|
11
|
+
|
|
12
|
+
from actions.git_clone_with.lib import git_clone_with
|
|
13
|
+
from actions.git_clone_with.settings import Settings
|
|
14
|
+
from actions.logging import LOGGER
|
|
15
|
+
from actions.utilities import LOADER
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from utilities.types import PathLike
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@argument("path_key", type=click.Path(exists=True, dir_okay=False, path_type=Path))
|
|
22
|
+
@argument("owner", type=str)
|
|
23
|
+
@argument("repo", type=str)
|
|
24
|
+
@click_options(Settings, [LOADER], show_envvars_in_help=True)
|
|
25
|
+
def git_clone_with_sub_cmd(
|
|
26
|
+
settings: Settings, /, *, path_key: PathLike, owner: str, repo: str
|
|
27
|
+
) -> None:
|
|
28
|
+
if is_pytest():
|
|
29
|
+
return
|
|
30
|
+
basic_config(obj=LOGGER)
|
|
31
|
+
git_clone_with(
|
|
32
|
+
path_key,
|
|
33
|
+
owner,
|
|
34
|
+
repo,
|
|
35
|
+
path_clone=settings.path_clone,
|
|
36
|
+
sudo=settings.sudo,
|
|
37
|
+
branch=settings.branch,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
__all__ = ["git_clone_with_sub_cmd"]
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
from utilities.atomicwrites import writer
|
|
7
|
+
from utilities.functions import get_func_name
|
|
8
|
+
from utilities.subprocess import cp, git_clone
|
|
9
|
+
from utilities.tabulate import func_param_desc
|
|
10
|
+
from utilities.text import strip_and_dedent
|
|
11
|
+
|
|
12
|
+
from actions import __version__
|
|
13
|
+
from actions.constants import SSH
|
|
14
|
+
from actions.git_clone_with.settings import SETTINGS
|
|
15
|
+
from actions.logging import LOGGER
|
|
16
|
+
from actions.setup_ssh_config.lib import get_ssh_config, setup_ssh_config
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from utilities.types import PathLike
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def git_clone_with(
|
|
23
|
+
path_key: PathLike,
|
|
24
|
+
owner: str,
|
|
25
|
+
repo: str,
|
|
26
|
+
/,
|
|
27
|
+
*,
|
|
28
|
+
path_clone: PathLike = SETTINGS.path_clone,
|
|
29
|
+
sudo: bool = SETTINGS.sudo,
|
|
30
|
+
branch: str | None = SETTINGS.branch,
|
|
31
|
+
) -> None:
|
|
32
|
+
LOGGER.info(
|
|
33
|
+
func_param_desc(
|
|
34
|
+
git_clone_with,
|
|
35
|
+
__version__,
|
|
36
|
+
f"{path_key=}",
|
|
37
|
+
f"{owner=}",
|
|
38
|
+
f"{repo=}",
|
|
39
|
+
f"{path_clone=}",
|
|
40
|
+
f"{sudo=}",
|
|
41
|
+
f"{branch=}",
|
|
42
|
+
)
|
|
43
|
+
)
|
|
44
|
+
path_key = Path(path_key)
|
|
45
|
+
setup_ssh_config()
|
|
46
|
+
_setup_ssh_config_for_key(path_key)
|
|
47
|
+
_setup_deploy_key(path_key)
|
|
48
|
+
git_clone(
|
|
49
|
+
f"git@{path_key.stem}:{owner}/{repo}", path_clone, sudo=sudo, branch=branch
|
|
50
|
+
)
|
|
51
|
+
LOGGER.info("Finished running %r", get_func_name(git_clone_with))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def _setup_ssh_config_for_key(path: PathLike, /) -> None:
|
|
55
|
+
path = Path(path)
|
|
56
|
+
stem = path.stem
|
|
57
|
+
path_key = _get_deploy_key(path.name)
|
|
58
|
+
text = strip_and_dedent(f"""
|
|
59
|
+
Host {stem}
|
|
60
|
+
HostName github.com
|
|
61
|
+
User git
|
|
62
|
+
IdentityFile {path_key}
|
|
63
|
+
IdentitiesOnly yes
|
|
64
|
+
""")
|
|
65
|
+
with writer(get_ssh_config(stem), overwrite=True) as temp:
|
|
66
|
+
_ = temp.write_text(text)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def _setup_deploy_key(path: PathLike, /) -> None:
|
|
70
|
+
path = Path(path)
|
|
71
|
+
cp(path, _get_deploy_key(path.name), perms="u=rw,g=,o=")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _get_deploy_key(name: str, /) -> Path:
|
|
75
|
+
return SSH / "deploy-keys" / name
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
__all__ = ["git_clone_with"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from typed_settings import load_settings, option, settings
|
|
6
|
+
|
|
7
|
+
from actions.utilities import LOADER
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@settings
|
|
11
|
+
class Settings:
|
|
12
|
+
path_clone: Path = option(default=Path.cwd(), help="Path to clone to")
|
|
13
|
+
sudo: bool = option(default=False, help="Run as sudo")
|
|
14
|
+
branch: str | None = option(default=None, help="Branch to check out")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
SETTINGS = load_settings(Settings, [LOADER])
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
__all__ = ["SETTINGS", "Settings"]
|
|
@@ -7,7 +7,6 @@ from typed_settings import Secret
|
|
|
7
7
|
|
|
8
8
|
from actions.pre_commit.conformalize_repo.settings import SETTINGS
|
|
9
9
|
from actions.publish_package.constants import PUBLISH_PACKAGE_DOCSTRING
|
|
10
|
-
from actions.random_sleep.constants import RANDOM_SLEEP_DOCSTRING
|
|
11
10
|
from actions.run_hooks.constants import RUN_HOOKS_DOCSTRING
|
|
12
11
|
from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING
|
|
13
12
|
|
|
@@ -17,10 +16,11 @@ if TYPE_CHECKING:
|
|
|
17
16
|
|
|
18
17
|
def action_publish_package_dict(
|
|
19
18
|
*,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
token_checkout: Secret[str] | None = SETTINGS.ci__token_checkout,
|
|
20
|
+
token_github: Secret[str] | None = SETTINGS.ci__token_github,
|
|
21
|
+
username: str | None = SETTINGS.ci__push__publish__primary__username,
|
|
22
|
+
password: Secret[str] | None = SETTINGS.ci__push__publish__primary__password,
|
|
23
|
+
publish_url: str | None = SETTINGS.ci__push__publish__primary__publish_url,
|
|
24
24
|
trusted_publishing: bool = False,
|
|
25
25
|
native_tls: bool = SETTINGS.uv__native_tls,
|
|
26
26
|
) -> StrDict:
|
|
@@ -29,7 +29,8 @@ def action_publish_package_dict(
|
|
|
29
29
|
"uses": "dycw/action-publish-package@latest",
|
|
30
30
|
}
|
|
31
31
|
with_: StrDict = {}
|
|
32
|
-
|
|
32
|
+
_add_token_checkout(with_, token=token_checkout)
|
|
33
|
+
_add_token_github(with_, token=token_github)
|
|
33
34
|
_add_item(with_, "username", value=username)
|
|
34
35
|
_add_item(with_, "password", value=password)
|
|
35
36
|
_add_item(with_, "publish-url", value=publish_url)
|
|
@@ -41,7 +42,8 @@ def action_publish_package_dict(
|
|
|
41
42
|
|
|
42
43
|
def action_pyright_dict(
|
|
43
44
|
*,
|
|
44
|
-
|
|
45
|
+
token_checkout: Secret[str] | None = SETTINGS.ci__token_checkout,
|
|
46
|
+
token_github: Secret[str] | None = SETTINGS.ci__token_github,
|
|
45
47
|
python_version: str | None = None,
|
|
46
48
|
resolution: str | None = None,
|
|
47
49
|
prerelease: str | None = None,
|
|
@@ -50,7 +52,8 @@ def action_pyright_dict(
|
|
|
50
52
|
) -> StrDict:
|
|
51
53
|
out: StrDict = {"name": "Run 'pyright'", "uses": "dycw/action-pyright@latest"}
|
|
52
54
|
with_: StrDict = {}
|
|
53
|
-
|
|
55
|
+
_add_token_checkout(with_, token=token_checkout)
|
|
56
|
+
_add_token_github(with_, token=token_github)
|
|
54
57
|
_add_python_version(with_, python_version=python_version)
|
|
55
58
|
_add_resolution(with_, resolution=resolution)
|
|
56
59
|
_add_prerelease(with_, prerelease=prerelease)
|
|
@@ -62,9 +65,10 @@ def action_pyright_dict(
|
|
|
62
65
|
|
|
63
66
|
def action_pytest_dict(
|
|
64
67
|
*,
|
|
65
|
-
|
|
68
|
+
token_checkout: Secret[str] | None = SETTINGS.ci__token_checkout,
|
|
69
|
+
token_github: Secret[str] | None = SETTINGS.ci__token_github,
|
|
66
70
|
python_version: str | None = None,
|
|
67
|
-
sops_age_key: str | None = None,
|
|
71
|
+
sops_age_key: Secret[str] | None = None,
|
|
68
72
|
resolution: str | None = None,
|
|
69
73
|
prerelease: str | None = None,
|
|
70
74
|
native_tls: bool = SETTINGS.uv__native_tls,
|
|
@@ -72,7 +76,8 @@ def action_pytest_dict(
|
|
|
72
76
|
) -> StrDict:
|
|
73
77
|
out: StrDict = {"name": "Run 'pytest'", "uses": "dycw/action-pytest@latest"}
|
|
74
78
|
with_: StrDict = {}
|
|
75
|
-
|
|
79
|
+
_add_token_checkout(with_, token=token_checkout)
|
|
80
|
+
_add_token_github(with_, token=token_github)
|
|
76
81
|
_add_python_version(with_, python_version=python_version)
|
|
77
82
|
_add_item(with_, "sops-age-key", value=sops_age_key)
|
|
78
83
|
_add_resolution(with_, resolution=resolution)
|
|
@@ -83,39 +88,23 @@ def action_pytest_dict(
|
|
|
83
88
|
return out
|
|
84
89
|
|
|
85
90
|
|
|
86
|
-
def
|
|
91
|
+
def action_ruff_dict(
|
|
87
92
|
*,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
max: int = 3600, # noqa: A002
|
|
91
|
-
step: int = 1,
|
|
92
|
-
log_freq: int = 1,
|
|
93
|
+
token_checkout: Secret[str] | None = SETTINGS.ci__token_checkout,
|
|
94
|
+
token_github: Secret[str] | None = SETTINGS.ci__token_github,
|
|
93
95
|
) -> StrDict:
|
|
94
|
-
out: StrDict = {
|
|
95
|
-
"name": RANDOM_SLEEP_DOCSTRING,
|
|
96
|
-
"uses": "dycw/action-random-sleep@latest",
|
|
97
|
-
}
|
|
98
|
-
with_: StrDict = {}
|
|
99
|
-
_add_token(with_, token=token)
|
|
100
|
-
with_["min"] = min
|
|
101
|
-
with_["max"] = max
|
|
102
|
-
with_["step"] = step
|
|
103
|
-
with_["log-freq"] = log_freq
|
|
104
|
-
_add_with_dict(out, with_)
|
|
105
|
-
return out
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def action_ruff_dict(*, token: str | None = SETTINGS.ci__token) -> StrDict:
|
|
109
96
|
out: StrDict = {"name": "Run 'ruff'", "uses": "dycw/action-ruff@latest"}
|
|
110
97
|
with_: StrDict = {}
|
|
111
|
-
|
|
98
|
+
_add_token_checkout(with_, token=token_checkout)
|
|
99
|
+
_add_token_github(with_, token=token_github)
|
|
112
100
|
_add_with_dict(out, with_)
|
|
113
101
|
return out
|
|
114
102
|
|
|
115
103
|
|
|
116
104
|
def action_run_hooks_dict(
|
|
117
105
|
*,
|
|
118
|
-
|
|
106
|
+
token_checkout: Secret[str] | None = SETTINGS.ci__token_checkout,
|
|
107
|
+
token_github: Secret[str] | None = SETTINGS.ci__token_github,
|
|
119
108
|
submodules: str | None = SETTINGS.ci__pull_request__pre_commit__submodules,
|
|
120
109
|
repos: list[str] | None = None,
|
|
121
110
|
hooks: list[str] | None = None,
|
|
@@ -129,7 +118,8 @@ def action_run_hooks_dict(
|
|
|
129
118
|
"uses": "dycw/action-run-hooks@latest",
|
|
130
119
|
}
|
|
131
120
|
with_: StrDict = {}
|
|
132
|
-
|
|
121
|
+
_add_token_checkout(with_, token=token_checkout)
|
|
122
|
+
_add_token_github(with_, token=token_github)
|
|
133
123
|
_add_item(with_, "submodules", value=submodules)
|
|
134
124
|
_add_yaml_str(with_, "repos", values=repos)
|
|
135
125
|
_add_yaml_str(with_, "hooks", values=hooks)
|
|
@@ -142,7 +132,8 @@ def action_run_hooks_dict(
|
|
|
142
132
|
|
|
143
133
|
def action_tag_commit_dict(
|
|
144
134
|
*,
|
|
145
|
-
|
|
135
|
+
token_checkout: Secret[str] | None = SETTINGS.ci__token_checkout,
|
|
136
|
+
token_github: Secret[str] | None = SETTINGS.ci__token_github,
|
|
146
137
|
user_name: str | None = None,
|
|
147
138
|
user_email: str | None = None,
|
|
148
139
|
major_minor: bool = False,
|
|
@@ -154,7 +145,8 @@ def action_tag_commit_dict(
|
|
|
154
145
|
"uses": "dycw/action-tag-commit@latest",
|
|
155
146
|
}
|
|
156
147
|
with_: StrDict = {}
|
|
157
|
-
|
|
148
|
+
_add_token_checkout(with_, token=token_checkout)
|
|
149
|
+
_add_token_github(with_, token=token_github)
|
|
158
150
|
_add_item(with_, "user-name", value=user_name)
|
|
159
151
|
_add_item(with_, "user-email", value=user_email)
|
|
160
152
|
_add_boolean(with_, "major-minor", value=major_minor)
|
|
@@ -209,8 +201,16 @@ def _add_resolution(dict_: StrDict, /, *, resolution: str | None = None) -> None
|
|
|
209
201
|
_add_item(dict_, "resolution", value=resolution)
|
|
210
202
|
|
|
211
203
|
|
|
212
|
-
def
|
|
213
|
-
|
|
204
|
+
def _add_token_checkout(
|
|
205
|
+
dict_: StrDict, /, *, token: Secret[str] | None = SETTINGS.ci__token_checkout
|
|
206
|
+
) -> None:
|
|
207
|
+
_add_item(dict_, "token-checkout", value=token)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def _add_token_github(
|
|
211
|
+
dict_: StrDict, /, *, token: Secret[str] | None = SETTINGS.ci__token_github
|
|
212
|
+
) -> None:
|
|
213
|
+
_add_item(dict_, "token-github", value=token)
|
|
214
214
|
|
|
215
215
|
|
|
216
216
|
def _add_with_dict(dict_: StrDict, with_: StrDict, /) -> None:
|
|
@@ -239,7 +239,6 @@ __all__ = [
|
|
|
239
239
|
"action_publish_package_dict",
|
|
240
240
|
"action_pyright_dict",
|
|
241
241
|
"action_pytest_dict",
|
|
242
|
-
"action_random_sleep_dict",
|
|
243
242
|
"action_ruff_dict",
|
|
244
243
|
"action_run_hooks_dict",
|
|
245
244
|
"action_tag_commit_dict",
|
|
@@ -16,10 +16,12 @@ def conformalize_repo_sub_cmd(settings: Settings, /) -> None:
|
|
|
16
16
|
return
|
|
17
17
|
basic_config(obj=LOGGER)
|
|
18
18
|
conformalize_repo(
|
|
19
|
-
|
|
19
|
+
ci__certificates=settings.ci__certificates,
|
|
20
20
|
ci__gitea=settings.ci__gitea,
|
|
21
|
-
|
|
21
|
+
ci__token_checkout=settings.ci__token_checkout,
|
|
22
|
+
ci__token_github=settings.ci__token_github,
|
|
22
23
|
ci__pull_request__pre_commit=settings.ci__pull_request__pre_commit,
|
|
24
|
+
ci__pull_request__pre_commit__submodules=settings.ci__pull_request__pre_commit__submodules,
|
|
23
25
|
ci__pull_request__pyright=settings.ci__pull_request__pyright,
|
|
24
26
|
ci__pull_request__pytest__macos=settings.ci__pull_request__pytest__macos,
|
|
25
27
|
ci__pull_request__pytest__ubuntu=settings.ci__pull_request__pytest__ubuntu,
|
|
@@ -27,7 +29,17 @@ def conformalize_repo_sub_cmd(settings: Settings, /) -> None:
|
|
|
27
29
|
ci__pull_request__pytest__all_versions=settings.ci__pull_request__pytest__all_versions,
|
|
28
30
|
ci__pull_request__pytest__sops_age_key=settings.ci__pull_request__pytest__sops_age_key,
|
|
29
31
|
ci__pull_request__ruff=settings.ci__pull_request__ruff,
|
|
30
|
-
|
|
32
|
+
ci__push__publish__github=settings.ci__push__publish__github,
|
|
33
|
+
ci__push__publish__primary=settings.ci__push__publish__primary,
|
|
34
|
+
ci__push__publish__primary__job_name=settings.ci__push__publish__primary__job_name,
|
|
35
|
+
ci__push__publish__primary__username=settings.ci__push__publish__primary__username,
|
|
36
|
+
ci__push__publish__primary__password=settings.ci__push__publish__primary__password,
|
|
37
|
+
ci__push__publish__primary__publish_url=settings.ci__push__publish__primary__publish_url,
|
|
38
|
+
ci__push__publish__secondary=settings.ci__push__publish__secondary,
|
|
39
|
+
ci__push__publish__secondary__job_name=settings.ci__push__publish__secondary__job_name,
|
|
40
|
+
ci__push__publish__secondary__username=settings.ci__push__publish__secondary__username,
|
|
41
|
+
ci__push__publish__secondary__password=settings.ci__push__publish__secondary__password,
|
|
42
|
+
ci__push__publish__secondary__publish_url=settings.ci__push__publish__secondary__publish_url,
|
|
31
43
|
ci__push__tag=settings.ci__push__tag,
|
|
32
44
|
ci__push__tag__all=settings.ci__push__tag__all,
|
|
33
45
|
coverage=settings.coverage,
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from re import search
|
|
5
|
+
|
|
6
|
+
from utilities.pathlib import GetRootError, get_root
|
|
7
|
+
from utilities.pytest import IS_CI
|
|
8
|
+
|
|
3
9
|
from actions.pre_commit.constants import PATH_PRE_COMMIT
|
|
4
10
|
|
|
5
11
|
DOCKERFMT_URL = "https://github.com/reteps/dockerfmt"
|
|
@@ -18,6 +24,13 @@ CONFORMALIZE_REPO_SUB_CMD = "conformalize-repo"
|
|
|
18
24
|
PATH_CONFIGS = PATH_PRE_COMMIT / "conformalize_repo/configs"
|
|
19
25
|
|
|
20
26
|
|
|
27
|
+
try:
|
|
28
|
+
root = get_root()
|
|
29
|
+
except GetRootError:
|
|
30
|
+
root = Path.cwd()
|
|
31
|
+
RUN_VERSION_BUMP = all(not search("template", p) for p in root.parts) and not IS_CI
|
|
32
|
+
|
|
33
|
+
|
|
21
34
|
__all__ = [
|
|
22
35
|
"CONFORMALIZE_REPO_DOCSTRING",
|
|
23
36
|
"CONFORMALIZE_REPO_SUB_CMD",
|
|
@@ -25,6 +38,7 @@ __all__ = [
|
|
|
25
38
|
"PATH_CONFIGS",
|
|
26
39
|
"PRE_COMMIT_HOOKS_URL",
|
|
27
40
|
"RUFF_URL",
|
|
41
|
+
"RUN_VERSION_BUMP",
|
|
28
42
|
"SHELLCHECK_URL",
|
|
29
43
|
"SHFMT_URL",
|
|
30
44
|
"TAPLO_URL",
|