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
|
@@ -10,11 +10,13 @@ from libcst.matchers import Subscript as MSubscript
|
|
|
10
10
|
from libcst.matchers import SubscriptElement as MSubscriptElement
|
|
11
11
|
from libcst.matchers import matches
|
|
12
12
|
from libcst.metadata import MetadataWrapper
|
|
13
|
+
from utilities.functions import get_func_name
|
|
14
|
+
from utilities.tabulate import func_param_desc
|
|
13
15
|
from utilities.text import repr_str
|
|
14
16
|
|
|
17
|
+
from actions import __version__
|
|
15
18
|
from actions.logging import LOGGER
|
|
16
19
|
from actions.pre_commit.utilities import yield_python_file
|
|
17
|
-
from actions.utilities import log_func_call
|
|
18
20
|
|
|
19
21
|
if TYPE_CHECKING:
|
|
20
22
|
from collections.abc import MutableSet
|
|
@@ -24,7 +26,7 @@ if TYPE_CHECKING:
|
|
|
24
26
|
|
|
25
27
|
|
|
26
28
|
def replace_sequence_strs(*paths: PathLike) -> None:
|
|
27
|
-
LOGGER.info(
|
|
29
|
+
LOGGER.info(func_param_desc(replace_sequence_strs, __version__, f"{paths=}"))
|
|
28
30
|
modifications: set[Path] = set()
|
|
29
31
|
for path in paths:
|
|
30
32
|
_format_path(path, modifications=modifications)
|
|
@@ -34,6 +36,7 @@ def replace_sequence_strs(*paths: PathLike) -> None:
|
|
|
34
36
|
", ".join(map(repr_str, sorted(modifications))),
|
|
35
37
|
)
|
|
36
38
|
sys.exit(1)
|
|
39
|
+
LOGGER.info("Finished running %r", get_func_name(replace_sequence_strs))
|
|
37
40
|
|
|
38
41
|
|
|
39
42
|
def _format_path(
|
|
@@ -4,13 +4,15 @@ import sys
|
|
|
4
4
|
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
6
|
from libcst import parse_statement
|
|
7
|
+
from utilities.functions import get_func_name
|
|
8
|
+
from utilities.tabulate import func_param_desc
|
|
7
9
|
from utilities.text import repr_str
|
|
8
10
|
from utilities.throttle import throttle
|
|
9
11
|
|
|
12
|
+
from actions import __version__
|
|
10
13
|
from actions.logging import LOGGER
|
|
11
14
|
from actions.pre_commit.constants import THROTTLE_DELTA
|
|
12
15
|
from actions.pre_commit.utilities import path_throttle_cache, yield_python_file
|
|
13
|
-
from actions.utilities import log_func_call
|
|
14
16
|
|
|
15
17
|
if TYPE_CHECKING:
|
|
16
18
|
from collections.abc import MutableSet
|
|
@@ -20,7 +22,7 @@ if TYPE_CHECKING:
|
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
def _touch_empty_py(*paths: PathLike) -> None:
|
|
23
|
-
LOGGER.info(
|
|
25
|
+
LOGGER.info(func_param_desc(touch_empty_py, __version__, f"{paths=}"))
|
|
24
26
|
modifications: set[Path] = set()
|
|
25
27
|
for path in paths:
|
|
26
28
|
_format_path(path, modifications=modifications)
|
|
@@ -30,6 +32,7 @@ def _touch_empty_py(*paths: PathLike) -> None:
|
|
|
30
32
|
", ".join(map(repr_str, sorted(modifications))),
|
|
31
33
|
)
|
|
32
34
|
sys.exit(1)
|
|
35
|
+
LOGGER.info("Finished running %r", get_func_name(touch_empty_py))
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
touch_empty_py = throttle(
|
|
@@ -4,14 +4,16 @@ import sys
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
|
+
from utilities.functions import get_func_name
|
|
7
8
|
from utilities.iterables import one
|
|
9
|
+
from utilities.tabulate import func_param_desc
|
|
8
10
|
from utilities.text import repr_str
|
|
9
11
|
from utilities.throttle import throttle
|
|
10
12
|
|
|
13
|
+
from actions import __version__
|
|
11
14
|
from actions.logging import LOGGER
|
|
12
15
|
from actions.pre_commit.constants import THROTTLE_DELTA
|
|
13
16
|
from actions.pre_commit.utilities import path_throttle_cache
|
|
14
|
-
from actions.utilities import log_func_call
|
|
15
17
|
|
|
16
18
|
if TYPE_CHECKING:
|
|
17
19
|
from collections.abc import MutableSet
|
|
@@ -20,7 +22,7 @@ if TYPE_CHECKING:
|
|
|
20
22
|
|
|
21
23
|
|
|
22
24
|
def _touch_py_typed(*paths: PathLike) -> None:
|
|
23
|
-
LOGGER.info(
|
|
25
|
+
LOGGER.info(func_param_desc(touch_py_typed, __version__, f"{paths=}"))
|
|
24
26
|
modifications: set[Path] = set()
|
|
25
27
|
for path in paths:
|
|
26
28
|
_format_path(path, modifications=modifications)
|
|
@@ -30,6 +32,7 @@ def _touch_py_typed(*paths: PathLike) -> None:
|
|
|
30
32
|
", ".join(map(repr_str, sorted(modifications))),
|
|
31
33
|
)
|
|
32
34
|
sys.exit(1)
|
|
35
|
+
LOGGER.info("Finished running %r", get_func_name(touch_py_typed))
|
|
33
36
|
|
|
34
37
|
|
|
35
38
|
touch_py_typed = throttle(
|
|
@@ -5,9 +5,11 @@ from functools import partial
|
|
|
5
5
|
from typing import TYPE_CHECKING
|
|
6
6
|
|
|
7
7
|
from pydantic import TypeAdapter
|
|
8
|
-
from utilities.functions import max_nullable
|
|
8
|
+
from utilities.functions import get_func_name, max_nullable
|
|
9
|
+
from utilities.tabulate import func_param_desc
|
|
9
10
|
from utilities.text import repr_str
|
|
10
11
|
|
|
12
|
+
from actions import __version__
|
|
11
13
|
from actions.logging import LOGGER
|
|
12
14
|
from actions.pre_commit.update_requirements.classes import (
|
|
13
15
|
PipListOutdatedOutput,
|
|
@@ -19,7 +21,7 @@ from actions.pre_commit.update_requirements.classes import (
|
|
|
19
21
|
parse_version2_or_3,
|
|
20
22
|
)
|
|
21
23
|
from actions.pre_commit.utilities import get_pyproject_dependencies, yield_toml_doc
|
|
22
|
-
from actions.utilities import
|
|
24
|
+
from actions.utilities import logged_run
|
|
23
25
|
|
|
24
26
|
if TYPE_CHECKING:
|
|
25
27
|
from collections.abc import MutableSet
|
|
@@ -32,7 +34,7 @@ if TYPE_CHECKING:
|
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
def update_requirements(*paths: PathLike) -> None:
|
|
35
|
-
LOGGER.info(
|
|
37
|
+
LOGGER.info(func_param_desc(update_requirements, __version__, f"{paths=}"))
|
|
36
38
|
modifications: set[Path] = set()
|
|
37
39
|
for path in paths:
|
|
38
40
|
_format_path(path, modifications=modifications)
|
|
@@ -42,6 +44,7 @@ def update_requirements(*paths: PathLike) -> None:
|
|
|
42
44
|
", ".join(map(repr_str, sorted(modifications))),
|
|
43
45
|
)
|
|
44
46
|
sys.exit(1)
|
|
47
|
+
LOGGER.info("Finished running %r", get_func_name(update_requirements))
|
|
45
48
|
|
|
46
49
|
|
|
47
50
|
def _format_path(
|
actions/publish_package/lib.py
CHANGED
|
@@ -2,11 +2,14 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
|
+
from utilities.functions import get_func_name
|
|
6
|
+
from utilities.tabulate import func_param_desc
|
|
5
7
|
from utilities.tempfile import TemporaryDirectory
|
|
6
8
|
|
|
9
|
+
from actions import __version__
|
|
7
10
|
from actions.logging import LOGGER
|
|
8
11
|
from actions.publish_package.settings import SETTINGS
|
|
9
|
-
from actions.utilities import
|
|
12
|
+
from actions.utilities import logged_run
|
|
10
13
|
|
|
11
14
|
if TYPE_CHECKING:
|
|
12
15
|
from typed_settings import Secret
|
|
@@ -20,14 +23,17 @@ def publish_package(
|
|
|
20
23
|
trusted_publishing: bool = SETTINGS.trusted_publishing,
|
|
21
24
|
native_tls: bool = SETTINGS.native_tls,
|
|
22
25
|
) -> None:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
LOGGER.info(
|
|
27
|
+
func_param_desc(
|
|
28
|
+
publish_package,
|
|
29
|
+
__version__,
|
|
30
|
+
f"{username=}",
|
|
31
|
+
f"{password=}",
|
|
32
|
+
f"{publish_url=}",
|
|
33
|
+
f"{trusted_publishing=}",
|
|
34
|
+
f"{native_tls=}",
|
|
35
|
+
)
|
|
36
|
+
)
|
|
31
37
|
with TemporaryDirectory() as temp:
|
|
32
38
|
logged_run("uv", "build", "--out-dir", str(temp), "--wheel", "--clear")
|
|
33
39
|
logged_run(
|
|
@@ -40,6 +46,7 @@ def publish_package(
|
|
|
40
46
|
*(["--native-tls"] if native_tls else []),
|
|
41
47
|
f"{temp}/*",
|
|
42
48
|
)
|
|
49
|
+
LOGGER.info("Finished running %r", get_func_name(publish_package))
|
|
43
50
|
|
|
44
51
|
|
|
45
52
|
__all__ = ["publish_package"]
|
actions/random_sleep/lib.py
CHANGED
|
@@ -4,12 +4,14 @@ from math import ceil, floor
|
|
|
4
4
|
from random import choice
|
|
5
5
|
from time import sleep
|
|
6
6
|
|
|
7
|
+
from utilities.functions import get_func_name
|
|
8
|
+
from utilities.tabulate import func_param_desc
|
|
7
9
|
from utilities.whenever import get_now
|
|
8
10
|
from whenever import TimeDelta, ZonedDateTime
|
|
9
11
|
|
|
12
|
+
from actions import __version__
|
|
10
13
|
from actions.logging import LOGGER
|
|
11
14
|
from actions.random_sleep.settings import SETTINGS
|
|
12
|
-
from actions.utilities import log_func_call
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
def random_sleep(
|
|
@@ -19,15 +21,18 @@ def random_sleep(
|
|
|
19
21
|
step: int = SETTINGS.step,
|
|
20
22
|
log_freq: int = SETTINGS.log_freq,
|
|
21
23
|
) -> None:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
LOGGER.info(
|
|
25
|
+
func_param_desc(
|
|
26
|
+
random_sleep, __version__, f"{min=}", f"{max=}", f"{step=}", f"{log_freq=}"
|
|
27
|
+
)
|
|
28
|
+
)
|
|
24
29
|
start = get_now()
|
|
25
30
|
delta = TimeDelta(seconds=choice(range(min, max, step)))
|
|
26
31
|
LOGGER.info("Sleeping for %s...", delta)
|
|
27
32
|
end = (start + delta).round(mode="ceil")
|
|
28
33
|
while (now := get_now()) < end:
|
|
29
34
|
_intermediate(start, now, end, log_freq=log_freq)
|
|
30
|
-
LOGGER.info("Finished
|
|
35
|
+
LOGGER.info("Finished running %r", get_func_name(random_sleep))
|
|
31
36
|
|
|
32
37
|
|
|
33
38
|
def _intermediate(
|
|
@@ -6,16 +6,16 @@ echo_date() { echo "[$(date +'%Y-%m-%d %H:%M:%S')] $*" >&2; }
|
|
|
6
6
|
|
|
7
7
|
# main
|
|
8
8
|
wait-for-it.sh \
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
--host="${GITEA_HOST}" \
|
|
10
|
+
--port="${GITEA_PORT}" \
|
|
11
|
+
--strict \
|
|
12
|
+
-- \
|
|
13
|
+
echo "${GITEA_HOST}:${GITEA_PORT} is up"
|
|
14
14
|
|
|
15
15
|
if ! command -v update-ca-certificates >/dev/null 2>&1; then
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
echo_date "Installing 'ca-certificates'..."
|
|
17
|
+
apk update
|
|
18
|
+
apk add --no-cache ca-certificates
|
|
19
19
|
fi
|
|
20
20
|
|
|
21
21
|
update-ca-certificates || true
|
|
@@ -7,8 +7,11 @@ from typing import TYPE_CHECKING
|
|
|
7
7
|
|
|
8
8
|
from requests import get
|
|
9
9
|
from utilities.atomicwrites import writer
|
|
10
|
+
from utilities.functions import get_func_name
|
|
10
11
|
from utilities.subprocess import chmod, rm_cmd, ssh, sudo_cmd
|
|
12
|
+
from utilities.tabulate import func_param_desc
|
|
11
13
|
|
|
14
|
+
from actions import __version__
|
|
12
15
|
from actions.logging import LOGGER
|
|
13
16
|
from actions.register_gitea_runner.constants import (
|
|
14
17
|
PATH_CACHE,
|
|
@@ -17,7 +20,7 @@ from actions.register_gitea_runner.constants import (
|
|
|
17
20
|
URL_WAIT_FOR_IT,
|
|
18
21
|
)
|
|
19
22
|
from actions.register_gitea_runner.settings import SETTINGS
|
|
20
|
-
from actions.utilities import
|
|
23
|
+
from actions.utilities import logged_run
|
|
21
24
|
|
|
22
25
|
if TYPE_CHECKING:
|
|
23
26
|
from utilities.types import PathLike
|
|
@@ -37,19 +40,22 @@ def register_gitea_runner(
|
|
|
37
40
|
runner_instance_name: str = SETTINGS.runner_instance_name,
|
|
38
41
|
) -> None:
|
|
39
42
|
"""Register against a remote instance of Gitea."""
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
LOGGER.info(
|
|
44
|
+
func_param_desc(
|
|
45
|
+
register_gitea_runner,
|
|
46
|
+
__version__,
|
|
47
|
+
f"{ssh_user=}",
|
|
48
|
+
f"{ssh_host=}",
|
|
49
|
+
f"{gitea_container_user=}",
|
|
50
|
+
f"{gitea_container_name=}",
|
|
51
|
+
f"{runner_certificate=}",
|
|
52
|
+
f"{runner_capacity=}",
|
|
53
|
+
f"{runner_container_name=}",
|
|
54
|
+
f"{gitea_host=}",
|
|
55
|
+
f"{gitea_port=}",
|
|
56
|
+
f"{runner_instance_name=}",
|
|
57
|
+
)
|
|
58
|
+
)
|
|
53
59
|
token = ssh(
|
|
54
60
|
ssh_user,
|
|
55
61
|
ssh_host,
|
|
@@ -66,6 +72,7 @@ def register_gitea_runner(
|
|
|
66
72
|
gitea_port=gitea_port,
|
|
67
73
|
runner_instance_name=runner_instance_name,
|
|
68
74
|
)
|
|
75
|
+
LOGGER.info("Finished running %r", get_func_name(register_gitea_runner))
|
|
69
76
|
|
|
70
77
|
|
|
71
78
|
def register_against_local(
|
|
@@ -155,6 +162,8 @@ def _docker_run_act_runner_args(
|
|
|
155
162
|
f"GITEA_RUNNER_REGISTRATION_TOKEN={token}",
|
|
156
163
|
"--name",
|
|
157
164
|
container_name,
|
|
165
|
+
"--restart",
|
|
166
|
+
"always",
|
|
158
167
|
"--volume",
|
|
159
168
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
160
169
|
"--volume",
|
actions/run_hooks/lib.py
CHANGED
|
@@ -7,13 +7,15 @@ from re import search
|
|
|
7
7
|
from subprocess import CalledProcessError
|
|
8
8
|
from typing import TYPE_CHECKING, Any
|
|
9
9
|
|
|
10
|
-
from utilities.functions import ensure_class, ensure_str
|
|
10
|
+
from utilities.functions import ensure_class, ensure_str, get_func_name
|
|
11
|
+
from utilities.tabulate import func_param_desc
|
|
11
12
|
from whenever import TimeDelta
|
|
12
13
|
from yaml import safe_load
|
|
13
14
|
|
|
15
|
+
from actions import __version__
|
|
14
16
|
from actions.logging import LOGGER
|
|
15
17
|
from actions.run_hooks.settings import SETTINGS
|
|
16
|
-
from actions.utilities import
|
|
18
|
+
from actions.utilities import logged_run
|
|
17
19
|
|
|
18
20
|
if TYPE_CHECKING:
|
|
19
21
|
from collections.abc import Iterator
|
|
@@ -26,8 +28,16 @@ def run_hooks(
|
|
|
26
28
|
hooks_exclude: list[str] | None = SETTINGS.hooks_exclude,
|
|
27
29
|
sleep: int = SETTINGS.sleep,
|
|
28
30
|
) -> None:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
LOGGER.info(
|
|
32
|
+
func_param_desc(
|
|
33
|
+
run_hooks,
|
|
34
|
+
__version__,
|
|
35
|
+
f"{repos=}",
|
|
36
|
+
f"{hooks=}",
|
|
37
|
+
f"{hooks_exclude=}",
|
|
38
|
+
f"{sleep=}",
|
|
39
|
+
)
|
|
40
|
+
)
|
|
31
41
|
results = {
|
|
32
42
|
hook: _run_hook(hook, sleep=sleep)
|
|
33
43
|
for hook in _yield_hooks(repos=repos, hooks=hooks, hooks_exclude=hooks_exclude)
|
|
@@ -36,6 +46,7 @@ def run_hooks(
|
|
|
36
46
|
if len(failed) >= 1:
|
|
37
47
|
msg = f"Failed hook(s): {', '.join(failed)}"
|
|
38
48
|
raise RuntimeError(msg)
|
|
49
|
+
LOGGER.info("Finished running %r", get_func_name(run_hooks))
|
|
39
50
|
|
|
40
51
|
|
|
41
52
|
def _yield_hooks(
|
actions/setup_cronjob/lib.py
CHANGED
|
@@ -3,13 +3,15 @@ from __future__ import annotations
|
|
|
3
3
|
from string import Template
|
|
4
4
|
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
|
+
from utilities.functions import get_func_name
|
|
6
7
|
from utilities.platform import SYSTEM
|
|
7
8
|
from utilities.subprocess import chmod, chown, tee
|
|
9
|
+
from utilities.tabulate import func_param_desc
|
|
8
10
|
|
|
11
|
+
from actions import __version__
|
|
9
12
|
from actions.logging import LOGGER
|
|
10
13
|
from actions.setup_cronjob.constants import PATH_CONFIGS
|
|
11
14
|
from actions.setup_cronjob.settings import SETTINGS
|
|
12
|
-
from actions.utilities import log_func_call
|
|
13
15
|
|
|
14
16
|
if TYPE_CHECKING:
|
|
15
17
|
from collections.abc import Sequence
|
|
@@ -30,18 +32,21 @@ def setup_cronjob(
|
|
|
30
32
|
logs_keep: int = SETTINGS.logs_keep,
|
|
31
33
|
) -> None:
|
|
32
34
|
"""Set up a cronjob & logrotate."""
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
LOGGER.info(
|
|
36
|
+
func_param_desc(
|
|
37
|
+
setup_cronjob,
|
|
38
|
+
__version__,
|
|
39
|
+
f"{name=}",
|
|
40
|
+
f"{prepend_path=}",
|
|
41
|
+
f"{schedule=}",
|
|
42
|
+
f"{user=}",
|
|
43
|
+
f"{timeout=}",
|
|
44
|
+
f"{kill_after=}",
|
|
45
|
+
f"{command=}",
|
|
46
|
+
f"{args=}",
|
|
47
|
+
f"{logs_keep=}",
|
|
48
|
+
)
|
|
49
|
+
)
|
|
45
50
|
if SYSTEM != "linux":
|
|
46
51
|
msg = f"System must be 'linux'; got {SYSTEM!r}"
|
|
47
52
|
raise TypeError(msg)
|
|
@@ -61,6 +66,7 @@ def setup_cronjob(
|
|
|
61
66
|
_tee_and_perms(
|
|
62
67
|
f"/etc/logrotate.d/{name}", _get_logrotate(name=name, logs_keep=logs_keep)
|
|
63
68
|
)
|
|
69
|
+
LOGGER.info("Finished running %r", get_func_name(setup_cronjob))
|
|
64
70
|
|
|
65
71
|
|
|
66
72
|
def _get_crontab(
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from utilities.logging import basic_config
|
|
4
|
+
from utilities.os import is_pytest
|
|
5
|
+
|
|
6
|
+
from actions.logging import LOGGER
|
|
7
|
+
from actions.setup_ssh_config.lib import setup_ssh_config
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def setup_ssh_config_sub_cmd() -> None:
|
|
11
|
+
if is_pytest():
|
|
12
|
+
return
|
|
13
|
+
basic_config(obj=LOGGER)
|
|
14
|
+
setup_ssh_config()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__all__ = ["setup_ssh_config_sub_cmd"]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
|
|
5
|
+
from utilities.atomicwrites import writer
|
|
6
|
+
from utilities.functions import get_func_name
|
|
7
|
+
from utilities.tabulate import func_param_desc
|
|
8
|
+
|
|
9
|
+
from actions import __version__
|
|
10
|
+
from actions.constants import SSH
|
|
11
|
+
from actions.logging import LOGGER
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def setup_ssh_config() -> None:
|
|
18
|
+
LOGGER.info(func_param_desc(setup_ssh_config, __version__))
|
|
19
|
+
path = get_ssh_config("*")
|
|
20
|
+
with writer(SSH / "config", overwrite=True) as temp:
|
|
21
|
+
_ = temp.write_text(f"Include {path}")
|
|
22
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
23
|
+
LOGGER.info("Finished running %r", get_func_name(setup_ssh_config))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_ssh_config(stem: str, /) -> Path:
|
|
27
|
+
return SSH / "config.d" / f"{stem}.conf"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
__all__ = ["setup_ssh_config"]
|
actions/tag_commit/lib.py
CHANGED
|
@@ -3,11 +3,14 @@ from __future__ import annotations
|
|
|
3
3
|
from contextlib import suppress
|
|
4
4
|
from subprocess import CalledProcessError
|
|
5
5
|
|
|
6
|
+
from utilities.functions import get_func_name
|
|
7
|
+
from utilities.tabulate import func_param_desc
|
|
6
8
|
from utilities.version import parse_version
|
|
7
9
|
|
|
10
|
+
from actions import __version__
|
|
8
11
|
from actions.logging import LOGGER
|
|
9
12
|
from actions.tag_commit.settings import SETTINGS
|
|
10
|
-
from actions.utilities import
|
|
13
|
+
from actions.utilities import logged_run
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
def tag_commit(
|
|
@@ -18,14 +21,17 @@ def tag_commit(
|
|
|
18
21
|
major: bool = SETTINGS.major,
|
|
19
22
|
latest: bool = SETTINGS.latest,
|
|
20
23
|
) -> None:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
LOGGER.info(
|
|
25
|
+
func_param_desc(
|
|
26
|
+
tag_commit,
|
|
27
|
+
__version__,
|
|
28
|
+
f"{user_name=}",
|
|
29
|
+
f"{user_email=}",
|
|
30
|
+
f"{major_minor=}",
|
|
31
|
+
f"{major=}",
|
|
32
|
+
f"{latest=}",
|
|
33
|
+
)
|
|
34
|
+
)
|
|
29
35
|
logged_run("git", "config", "--global", "user.name", user_name)
|
|
30
36
|
logged_run("git", "config", "--global", "user.email", user_email)
|
|
31
37
|
version = parse_version(
|
|
@@ -38,6 +44,7 @@ def tag_commit(
|
|
|
38
44
|
_tag(str(version.major))
|
|
39
45
|
if latest:
|
|
40
46
|
_tag("latest")
|
|
47
|
+
LOGGER.info("Finished running %r", get_func_name(tag_commit))
|
|
41
48
|
|
|
42
49
|
|
|
43
50
|
def _tag(version: str, /) -> None:
|
actions/utilities.py
CHANGED
|
@@ -2,22 +2,18 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from io import StringIO
|
|
4
4
|
from pathlib import Path
|
|
5
|
-
from textwrap import indent
|
|
6
5
|
from typing import TYPE_CHECKING, Any, Literal, assert_never, overload
|
|
7
6
|
|
|
8
|
-
from tabulate import tabulate
|
|
9
7
|
from typed_settings import EnvLoader, Secret
|
|
10
8
|
from utilities.atomicwrites import writer
|
|
11
|
-
from utilities.functions import get_func_name
|
|
12
9
|
from utilities.subprocess import run
|
|
13
10
|
from utilities.text import split_str
|
|
14
11
|
|
|
15
|
-
from actions import __version__
|
|
16
12
|
from actions.constants import YAML_INSTANCE
|
|
17
13
|
from actions.logging import LOGGER
|
|
18
14
|
|
|
19
15
|
if TYPE_CHECKING:
|
|
20
|
-
from collections.abc import
|
|
16
|
+
from collections.abc import MutableSet
|
|
21
17
|
|
|
22
18
|
from utilities.types import PathLike, StrStrMapping
|
|
23
19
|
|
|
@@ -87,17 +83,6 @@ def ensure_new_line(text: str, /) -> str:
|
|
|
87
83
|
return text.strip("\n") + "\n"
|
|
88
84
|
|
|
89
85
|
|
|
90
|
-
def log_func_call(func: Callable[..., Any], /, *variables: str) -> str:
|
|
91
|
-
name = get_func_name(func)
|
|
92
|
-
table = tabulate(
|
|
93
|
-
list(map(split_f_str_equals, variables)), tablefmt="rounded_outline"
|
|
94
|
-
)
|
|
95
|
-
indented = indent(table, " ")
|
|
96
|
-
return f"""
|
|
97
|
-
Running {name!r} (version {__version__}) with:
|
|
98
|
-
{indented}"""
|
|
99
|
-
|
|
100
|
-
|
|
101
86
|
@overload
|
|
102
87
|
def logged_run(
|
|
103
88
|
cmd: SecretLike,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: dycw-actions
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.3
|
|
4
4
|
Summary: Library of actions
|
|
5
5
|
Requires-Dist: click>=8.3.1,<9
|
|
6
|
-
Requires-Dist: dycw-utilities>=0.179.
|
|
6
|
+
Requires-Dist: dycw-utilities>=0.179.3,<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
|
|
@@ -13,7 +13,7 @@ Requires-Dist: requests>=2.32.5,<3
|
|
|
13
13
|
Requires-Dist: rich>=14.2.0,<15
|
|
14
14
|
Requires-Dist: ruamel-yaml>=0.19.1,<1
|
|
15
15
|
Requires-Dist: tabulate>=0.9.0,<1
|
|
16
|
-
Requires-Dist: tomlkit>=0.
|
|
16
|
+
Requires-Dist: tomlkit>=0.14.0,<1
|
|
17
17
|
Requires-Dist: typed-settings[attrs,click]>=25.3.0,<26
|
|
18
18
|
Requires-Dist: xdg-base-dirs>=6.0.2,<7
|
|
19
19
|
Requires-Python: >=3.12
|