bitwarden_workflow_linter 0.12.8__py3-none-any.whl → 0.13.0__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.
- bitwarden_workflow_linter/__about__.py +1 -1
- bitwarden_workflow_linter/actionlint_version.yaml +1 -0
- bitwarden_workflow_linter/rules/run_actionlint.py +8 -20
- bitwarden_workflow_linter/utils.py +20 -1
- {bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/METADATA +1 -1
- {bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/RECORD +9 -8
- {bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/WHEEL +0 -0
- {bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/entry_points.txt +0 -0
- {bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/licenses/LICENSE.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
actionlint_version: "1.7.7"
|
@@ -5,21 +5,20 @@ import subprocess
|
|
5
5
|
import platform
|
6
6
|
import urllib.request
|
7
7
|
import os
|
8
|
-
import json
|
9
8
|
|
10
9
|
from ..rule import Rule
|
11
10
|
from ..models.workflow import Workflow
|
12
11
|
from ..utils import LintLevels, Settings
|
13
12
|
|
14
13
|
|
15
|
-
def install_actionlint(platform_system: str) -> Tuple[bool, str]:
|
14
|
+
def install_actionlint(platform_system: str, version: str) -> Tuple[bool, str]:
|
16
15
|
"""If actionlint is not installed, detects OS platform
|
17
16
|
and installs actionlint"""
|
18
17
|
|
19
18
|
error = f"An error occurred when installing Actionlint on {platform_system}"
|
20
19
|
|
21
20
|
if platform_system.startswith("Linux"):
|
22
|
-
return install_actionlint_source(error)
|
21
|
+
return install_actionlint_source(error,version)
|
23
22
|
elif platform_system == "Darwin":
|
24
23
|
try:
|
25
24
|
subprocess.run(["brew", "install", "actionlint"], check=True)
|
@@ -34,20 +33,8 @@ def install_actionlint(platform_system: str) -> Tuple[bool, str]:
|
|
34
33
|
return False, f"{error} : check Choco installation"
|
35
34
|
return False, error
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
# """Load configuration from a JSON file."""
|
40
|
-
# config_path = os.path.join(os.path.dirname(__file__), "../../../actionlint_version.json")
|
41
|
-
# if not os.path.exists(config_path):
|
42
|
-
# raise FileNotFoundError(f"Configuration file not found: {config_path}")
|
43
|
-
# with open(config_path, "r") as config_file:
|
44
|
-
# return json.load(config_file)
|
45
|
-
|
46
|
-
def install_actionlint_source(error) -> Tuple[bool, str]:
|
47
|
-
#config = load_config()
|
48
|
-
#if "actionlint_version" not in config:
|
49
|
-
# raise KeyError("The 'actionlint_version' is missing in the configuration file.")
|
50
|
-
version = "1.7.7"
|
36
|
+
def install_actionlint_source(error, version) -> Tuple[bool, str]:
|
37
|
+
version = version
|
51
38
|
"""Install Actionlint Binary from provided script"""
|
52
39
|
url = "https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash"
|
53
40
|
request = urllib.request.urlopen(url)
|
@@ -60,7 +47,7 @@ def install_actionlint_source(error) -> Tuple[bool, str]:
|
|
60
47
|
return False, error
|
61
48
|
|
62
49
|
|
63
|
-
def check_actionlint(platform_system: str) -> Tuple[bool, str]:
|
50
|
+
def check_actionlint(platform_system: str, version: str) -> Tuple[bool, str]:
|
64
51
|
"""Check if the actionlint is in the system's PATH."""
|
65
52
|
try:
|
66
53
|
subprocess.run(
|
@@ -77,7 +64,7 @@ def check_actionlint(platform_system: str) -> Tuple[bool, str]:
|
|
77
64
|
please check your package installer or manually install it",
|
78
65
|
)
|
79
66
|
except FileNotFoundError:
|
80
|
-
return install_actionlint(platform_system)
|
67
|
+
return install_actionlint(platform_system, version)
|
81
68
|
|
82
69
|
|
83
70
|
class RunActionlint(Rule):
|
@@ -95,7 +82,8 @@ class RunActionlint(Rule):
|
|
95
82
|
"Running actionlint without a filename is not currently supported"
|
96
83
|
)
|
97
84
|
|
98
|
-
installed
|
85
|
+
"""Check if Actionlint is alerady installed and if it is installed somewhere not on the PATH (location)"""
|
86
|
+
installed, location = check_actionlint(platform.system(), self.settings.actionlint_version)
|
99
87
|
if installed:
|
100
88
|
if location:
|
101
89
|
result = subprocess.run(
|
@@ -107,17 +107,18 @@ class SettingsError(Exception):
|
|
107
107
|
|
108
108
|
SettingsFromFactory = TypeVar("SettingsFromFactory", bound="Settings")
|
109
109
|
|
110
|
-
|
111
110
|
class Settings:
|
112
111
|
"""Class that contains configuration-as-code for any portion of the app."""
|
113
112
|
|
114
113
|
enabled_rules: list[dict[str, str]]
|
115
114
|
approved_actions: dict[str, Action]
|
115
|
+
actionlint_version: str
|
116
116
|
|
117
117
|
def __init__(
|
118
118
|
self,
|
119
119
|
enabled_rules: Optional[list[dict[str, str]]] = None,
|
120
120
|
approved_actions: Optional[dict[str, dict[str, str]]] = None,
|
121
|
+
actionlint_version: Optional[str] = None,
|
121
122
|
) -> None:
|
122
123
|
"""Settings object that can be overridden in settings.py.
|
123
124
|
|
@@ -134,7 +135,11 @@ class Settings:
|
|
134
135
|
|
135
136
|
if approved_actions is None:
|
136
137
|
approved_actions = {}
|
138
|
+
|
139
|
+
if actionlint_version is None:
|
140
|
+
actionlint_version = ""
|
137
141
|
|
142
|
+
self.actionlint_version = actionlint_version
|
138
143
|
self.enabled_rules = enabled_rules
|
139
144
|
self.approved_actions = {
|
140
145
|
name: Action(**action) for name, action in approved_actions.items()
|
@@ -142,6 +147,7 @@ class Settings:
|
|
142
147
|
|
143
148
|
@staticmethod
|
144
149
|
def factory() -> SettingsFromFactory:
|
150
|
+
# load default settings
|
145
151
|
with (
|
146
152
|
importlib.resources.files("bitwarden_workflow_linter")
|
147
153
|
.joinpath("default_settings.yaml")
|
@@ -149,6 +155,16 @@ class Settings:
|
|
149
155
|
):
|
150
156
|
settings = yaml.load(file)
|
151
157
|
|
158
|
+
# load actionlint version
|
159
|
+
with (
|
160
|
+
importlib.resources.files("bitwarden_workflow_linter")
|
161
|
+
.joinpath("actionlint_version.yaml")
|
162
|
+
.open("r", encoding="utf-8") as version_file
|
163
|
+
):
|
164
|
+
version_data = yaml.load(version_file)
|
165
|
+
actionlint_version = version_data["actionlint_version"]
|
166
|
+
|
167
|
+
# load override settings
|
152
168
|
settings_filename = "settings.yaml"
|
153
169
|
local_settings = None
|
154
170
|
|
@@ -159,6 +175,7 @@ class Settings:
|
|
159
175
|
if local_settings:
|
160
176
|
settings.update(local_settings)
|
161
177
|
|
178
|
+
# load approved actions
|
162
179
|
if settings["approved_actions_path"] == "default_actions.json":
|
163
180
|
with (
|
164
181
|
importlib.resources.files("bitwarden_workflow_linter")
|
@@ -172,7 +189,9 @@ class Settings:
|
|
172
189
|
) as action_file:
|
173
190
|
settings["approved_actions"] = json.load(action_file)
|
174
191
|
|
192
|
+
|
175
193
|
return Settings(
|
176
194
|
enabled_rules=settings["enabled_rules"],
|
177
195
|
approved_actions=settings["approved_actions"],
|
196
|
+
actionlint_version=actionlint_version,
|
178
197
|
)
|
{bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: bitwarden_workflow_linter
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.13.0
|
4
4
|
Summary: Custom GitHub Action Workflow Linter
|
5
5
|
Project-URL: Homepage, https://github.com/bitwarden/workflow-linter
|
6
6
|
Project-URL: Issues, https://github.com/bitwarden/workflow-linter/issues
|
{bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/RECORD
RENAMED
@@ -1,5 +1,6 @@
|
|
1
|
-
bitwarden_workflow_linter/__about__.py,sha256=
|
1
|
+
bitwarden_workflow_linter/__about__.py,sha256=f5QTzIvY76oCTstHg8y_8_yGGrjcJvuwpeka56B-4eM,60
|
2
2
|
bitwarden_workflow_linter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
bitwarden_workflow_linter/actionlint_version.yaml,sha256=CKhiDwaDBNCExOHTlcpiavfEgf01uG_tTPrgLRaj6_k,28
|
3
4
|
bitwarden_workflow_linter/actions.py,sha256=LAn3yQeMMmCOvJWeTn3dE1U2nyEJqIBMwESq3TtY9hE,9069
|
4
5
|
bitwarden_workflow_linter/cli.py,sha256=wgkK1MlVbo6Zx3f2CZZ_tkSWq_hdsGciHJA1knX6Yuw,1699
|
5
6
|
bitwarden_workflow_linter/default_actions.json,sha256=gmjTUnLl1QpovMt5siNxP-qGkSNmXMSRvt4Ud1jne4c,13523
|
@@ -7,7 +8,7 @@ bitwarden_workflow_linter/default_settings.yaml,sha256=XCaRFqdJ_lbNUDlPthySZzF0d
|
|
7
8
|
bitwarden_workflow_linter/lint.py,sha256=R0dXkwir0KzXFHWfWlqpH_CyBwa7O8wHSBTy560u94g,6322
|
8
9
|
bitwarden_workflow_linter/load.py,sha256=FWxotIlB0vyKzrVw87sOx3qdRiJG_0hVHRbbLXZY4Sc,5553
|
9
10
|
bitwarden_workflow_linter/rule.py,sha256=Qb60JiUDAWN3ayrMGoSbbDCSFmw-ql8djzAkxISaob4,3250
|
10
|
-
bitwarden_workflow_linter/utils.py,sha256=
|
11
|
+
bitwarden_workflow_linter/utils.py,sha256=8FhDq71kOWqoN61H9Iy10HrFSbdaSjb6QlpjPR8YhQ0,5441
|
11
12
|
bitwarden_workflow_linter/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
12
13
|
bitwarden_workflow_linter/models/job.py,sha256=d4F0QG35DqaqgfbPa2YDRRxOZZakFDktIOsuUa-BbC8,2387
|
13
14
|
bitwarden_workflow_linter/models/step.py,sha256=j81iWYWcNI9x55n1MOR0N6ogKaQ_4-CKu9LnI_fwEOE,1814
|
@@ -19,12 +20,12 @@ bitwarden_workflow_linter/rules/name_capitalized.py,sha256=lGHPi_Ix0DVSzGEdrUm2v
|
|
19
20
|
bitwarden_workflow_linter/rules/name_exists.py,sha256=kdMIURN3u8qdDvw6YKxg7VF5bkzGxVVXAO3KAqY1-54,1826
|
20
21
|
bitwarden_workflow_linter/rules/permissions_exist.py,sha256=_qOonJ0tyIH3Wp0e-0cppyVIbY9Sr7DuZPZdwxjYMaI,1432
|
21
22
|
bitwarden_workflow_linter/rules/pinned_job_runner.py,sha256=VPQfMu3SgIFdl-B8wOXzzK6tMx2hWWSJbKL5KG3xcaI,1751
|
22
|
-
bitwarden_workflow_linter/rules/run_actionlint.py,sha256=
|
23
|
+
bitwarden_workflow_linter/rules/run_actionlint.py,sha256=8ovmccFiWtqLJNE1_QO3rKgmnL8ss4dbnq1SC3t2OX4,4007
|
23
24
|
bitwarden_workflow_linter/rules/step_approved.py,sha256=4pUCrOlWomo43bwGBunORphv1RJzc3spRKgZ4VLtDS0,3304
|
24
25
|
bitwarden_workflow_linter/rules/step_pinned.py,sha256=MagV8LNdgRKyncmSdH9V-TlIcsdjzoDHDWqovzWon9E,3559
|
25
26
|
bitwarden_workflow_linter/rules/underscore_outputs.py,sha256=LoCsDN_EfQ8H9n5BfZ5xCe7BeHqJGPMcV0vo1c9YJcw,4275
|
26
|
-
bitwarden_workflow_linter-0.
|
27
|
-
bitwarden_workflow_linter-0.
|
28
|
-
bitwarden_workflow_linter-0.
|
29
|
-
bitwarden_workflow_linter-0.
|
30
|
-
bitwarden_workflow_linter-0.
|
27
|
+
bitwarden_workflow_linter-0.13.0.dist-info/METADATA,sha256=yYyaD29hRHP4Uuey5Idv-C-IsCCTylTpBs5AcMJwMNw,9797
|
28
|
+
bitwarden_workflow_linter-0.13.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
29
|
+
bitwarden_workflow_linter-0.13.0.dist-info/entry_points.txt,sha256=SA_yF9CwL4VMUvdcmCd7k9rjsQNzfeOUBuDnMnaO8QQ,60
|
30
|
+
bitwarden_workflow_linter-0.13.0.dist-info/licenses/LICENSE.txt,sha256=uY-7N9tbI7xc_c0WeTIGpacSCnsB91N05eCIg3bkaRw,35140
|
31
|
+
bitwarden_workflow_linter-0.13.0.dist-info/RECORD,,
|
{bitwarden_workflow_linter-0.12.8.dist-info → bitwarden_workflow_linter-0.13.0.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|
File without changes
|