From 1c0c8f31c81a3c3580a1bba9a5abec232fdf8cf1 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Thu, 29 Feb 2024 11:19:31 -0800 Subject: [PATCH] Update all spelling errors identified and path issues (Thanks @vgrassia!) --- lint-workflow-v2/README.md | 4 +-- lint-workflow-v2/pyproject.toml | 3 +-- lint-workflow-v2/pyproject.toml.tpl | 3 +-- .../src/bitwarden_workflow_linter/actions.py | 24 ++++++++--------- .../src/bitwarden_workflow_linter/cli.py | 4 +-- .../src/bitwarden_workflow_linter/lint.py | 14 +++++----- .../src/bitwarden_workflow_linter/load.py | 25 +++--------------- .../bitwarden_workflow_linter/models/job.py | 2 +- .../bitwarden_workflow_linter/models/step.py | 2 +- .../models/workflow.py | 2 +- .../src/bitwarden_workflow_linter/rule.py | 6 ++--- .../rules/job_environment_prefix.py | 10 +++---- .../rules/name_capitalized.py | 4 +-- .../rules/name_exists.py | 6 ++--- .../rules/pinned_job_runner.py | 6 ++--- .../rules/step_approved.py | 6 ++--- .../rules/step_pinned.py | 4 +-- .../src/bitwarden_workflow_linter/utils.py | 6 ++--- lint-workflow-v2/tests/conftest.py | 2 +- lint-workflow-v2/tests/fixtures/test.yml | 26 +++++++------------ .../rules/test_job_environment_prefix.py | 2 +- .../tests/rules/test_name_capitalized.py | 2 +- .../tests/rules/test_name_exists.py | 2 +- .../tests/rules/test_pinned_job_runner.py | 2 +- .../tests/rules/test_step_approved.py | 2 +- .../tests/rules/test_step_pinned.py | 2 +- lint-workflow-v2/tests/test_job.py | 2 +- lint-workflow-v2/tests/test_lint.py | 2 +- lint-workflow-v2/tests/test_load.py | 2 +- lint-workflow-v2/tests/test_rule.py | 2 +- lint-workflow-v2/tests/test_step.py | 2 +- lint-workflow-v2/tests/test_utils.py | 2 +- lint-workflow-v2/tests/test_workflow.py | 2 +- 33 files changed, 78 insertions(+), 107 deletions(-) diff --git a/lint-workflow-v2/README.md b/lint-workflow-v2/README.md index d9f4cc1e..557ca6d1 100644 --- a/lint-workflow-v2/README.md +++ b/lint-workflow-v2/README.md @@ -61,7 +61,7 @@ pipenv shell ### Testing -All built-in `src/rules` should have 100% code coverage and we should shoot for an overall coverage of 80%+. +All built-in `src/bitwarden_workflow_linter/rules` should have 100% code coverage and we should shoot for an overall coverage of 80%+. We are lax on the [imperative shell](https://www.destroyallsoftware.com/screencasts/catalog/functional-core-imperative-shell) (code interacting with other systems; ie. disk, network, etc), but we strive to maintain a high coverage over the @@ -124,8 +124,6 @@ class RuleJobNameExists(Rule): return False, self.message ``` -[TODO: Is this enough documentation on how to use?] - By default, a new Rule needs five things: - `self.message`: The message to return to the user on a lint failure diff --git a/lint-workflow-v2/pyproject.toml b/lint-workflow-v2/pyproject.toml index 7f695bdd..cf65d04f 100644 --- a/lint-workflow-v2/pyproject.toml +++ b/lint-workflow-v2/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "bitwarden_workflow_linter" dynamic = ["version"] -authors = [] +authors = ["Bitwarden Inc"] description = "Custom GitHub Action Workflow Linter" readme = "README.md" requires-python = ">=3.11" @@ -35,7 +35,6 @@ dependencies = [ Homepage = "https://github.com/bitwarden/gh-actions/tree/main/lint-workflow-v2" Issues = "https://github.com/bitwarden/gh-actions/issues" - [project.scripts] bwwl = "bitwarden_workflow_linter.cli:main" diff --git a/lint-workflow-v2/pyproject.toml.tpl b/lint-workflow-v2/pyproject.toml.tpl index cb3a2601..472b8471 100644 --- a/lint-workflow-v2/pyproject.toml.tpl +++ b/lint-workflow-v2/pyproject.toml.tpl @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "bitwarden_workflow_linter" dynamic = ["version"] -authors = [] +authors = ["Bitwarden Inc"] description = "Custom GitHub Action Workflow Linter" readme = "README.md" requires-python = ">=3.11" @@ -23,7 +23,6 @@ $DEPS Homepage = "https://github.com/bitwarden/gh-actions/tree/main/lint-workflow-v2" Issues = "https://github.com/bitwarden/gh-actions/issues" - [project.scripts] bwwl = "bitwarden_workflow_linter.cli:main" diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/actions.py b/lint-workflow-v2/src/bitwarden_workflow_linter/actions.py index c8744150..90cd0bae 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/actions.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/actions.py @@ -26,11 +26,11 @@ class ActionsCmd: """ def __init__(self, settings: Optional[Settings] = None) -> None: - """Initialize the the ActionsCmd class. + """Initialize the ActionsCmd class. Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.settings = settings @@ -41,12 +41,12 @@ def extend_parser( ) -> argparse._SubParsersAction: """Extends the CLI subparser with the options for ActionCmd. - Add 'actions add' and 'actions update' to the CLI as sub-commands + Add 'actions add' and 'actions update' to the CLI as subcommands along with the options and arguments for each. Args: subparsers: - The main argument parser to add sub commands and arguments to + The main argument parser to add subcommands and arguments to """ parser_actions = subparsers.add_parser( "actions", help="!!BETA!!\nAdd or Update Actions in the pre-approved list." @@ -61,7 +61,7 @@ def extend_parser( parser_actions_add = subparsers_actions.add_parser( "add", help="add action to approved list" ) - parser_actions_add.add_argument("name", help="action name [git owener/repo]") + parser_actions_add.add_argument("name", help="action name [git owner/repo]") return subparsers @@ -96,13 +96,13 @@ def get_github_api_response( return response def exists(self, action: Action) -> bool: - """Takes and action id and checks if the action repo exists.""" + """Takes an action id and checks if the action repository exists.""" url = f"https://api.github.com/repos/{action.name}" response = self.get_github_api_response(url, action.name) if response is None: - # Handle github api limit exceed by returning that the action exists + # Handle exceeding GitHub API limit by returning that the action exists # without actually checking to prevent false errors on linter output. Only # show it as an linter error. return True @@ -159,7 +159,7 @@ def save_actions(self, updated_actions: dict[str, Action], filename: str) -> Non ) def add(self, new_action_name: str, filename: str) -> int: - """Sub-command to add a new Action to the list of approved Actions. + """Subcommand to add a new Action to the list of approved Actions. 'actions add' will add an Action and all of its metadata and dump all approved actions (including the new one) to either the default JSON file @@ -178,11 +178,11 @@ def add(self, new_action_name: str, filename: str) -> int: return 0 def update(self, filename: str) -> int: - """Sub-command to update all of the versions of the approved actions. + """Subcommand to update all of the versions of the approved actions. - 'actions update' will update all of the approved to the newest version - and dump all of the new data to either the default JSON file or the - one provided by '--output' + 'actions update' will update all of the approved actions to the newest + version and dump all of the new data to either the default JSON file or + the one provided by '--output' """ print("Actions: update") updated_actions = {} diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/cli.py b/lint-workflow-v2/src/bitwarden_workflow_linter/cli.py index 13e984a7..6f9e662a 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/cli.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/cli.py @@ -6,8 +6,8 @@ from typing import List, Optional from .actions import ActionsCmd -from .utils import Settings from .lint import LinterCmd +from .utils import Settings local_settings = Settings.factory() @@ -17,7 +17,7 @@ def main(input_args: Optional[List[str]] = None) -> int: """CLI utility to lint GitHub Action Workflows. A CLI utility to enforce coding standards on GitHub Action workflows. The - utility also provides other sub-commands to assist with other workflow + utility also provides other subcommands to assist with other workflow maintenance tasks; such as maintaining the list of approved GitHub Actions. """ linter_cmd = LinterCmd(settings=local_settings) diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py b/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py index 242f6c8b..ebc18165 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/lint.py @@ -21,11 +21,11 @@ class LinterCmd: """ def __init__(self, settings: Optional[Settings] = None) -> None: - """Initailized the LinterCmd class. + """Initailize the LinterCmd class. Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.rules = Rules(settings=settings) @@ -36,11 +36,11 @@ def extend_parser( ) -> argparse._SubParsersAction: """Extends the CLI subparser with the options for LintCmd. - Add 'lint' as a sub command along with its options and arguments + Add 'lint' as a subcommand along with its options and arguments Args: subparsers: - The main argument parser to add sub commands and arguments to + The main argument parser to add subcommands and arguments to """ parser_lint = subparsers.add_parser( "lint", @@ -69,7 +69,7 @@ def get_max_error_level(self, findings: list[LintFinding]) -> int: Args: findings: - All of the findings that the linter found while linting a workflows. + All of the findings that the linter found while linting a workflow. Return: The numeric value of the maximum lint finding @@ -127,7 +127,7 @@ def generate_files(self, files: list[str]) -> list[str]: Args: files: - list of file names or director names. + list of file names or directory names. Returns: A sorted set of all workflow files in the path(s) specified. @@ -150,7 +150,7 @@ def run(self, input_files: list[str], strict: bool = False) -> int: Args: input_files: - list of file names or director names. + list of file names or directory names. strict: fail on WARNING instead of succeed diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/load.py b/lint-workflow-v2/src/bitwarden_workflow_linter/load.py index 4dc52b3b..a378f0f6 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/load.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/load.py @@ -1,4 +1,4 @@ -"""Module to load for Worflows and Rules.""" +"""Module to load for Workflows and Rules.""" import importlib @@ -36,7 +36,7 @@ def __load_workflow_from_file(cls, filename: str) -> CommentedMap: Returns: A CommentedMap that contains the dict() representation of the - yaml file. It includes the comments as a part of their respective + YAML file. It includes the comments as a part of their respective objects (depending on their location in the file). """ with open(filename, encoding="utf8") as file: @@ -55,25 +55,6 @@ def __build_workflow(cls, loaded_yaml: CommentedMap) -> Workflow: """ return Workflow.init("", loaded_yaml) - # return Workflow.from_dict( - # { - # **loaded_yaml, - # "jobs": { - # str(job_key): Job.init( - # job_key, - # { - # **job, - # "steps": [ - # Step.init(idx, job_key, step_data) - # for idx, step_data in enumerate(job["steps"]) - # ], - # }, - # ) - # for job_key, job in loaded_yaml["jobs"].items() - # }, - # } - # ) - @classmethod def build( cls, @@ -128,7 +109,7 @@ def __init__(self, settings: Settings) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ for rule in settings.enabled_rules: diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/models/job.py b/lint-workflow-v2/src/bitwarden_workflow_linter/models/job.py index b9ac9081..8915ba33 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/models/job.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/models/job.py @@ -15,7 +15,7 @@ class Job: """Represents a job in a GitHub Action workflow. This object contains all of the data that is required to run the current linting - Rules against. If a new Rule requies a key that is missing, the attribute should + Rules against. If a new Rule requires a key that is missing, the attribute should be added to this class to make it available for use in linting. """ diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/models/step.py b/lint-workflow-v2/src/bitwarden_workflow_linter/models/step.py index 34012fa0..e18f89d3 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/models/step.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/models/step.py @@ -13,7 +13,7 @@ class Step: """Represents a step in a GitHub Action workflow job. This object contains all of the data that is required to run the current linting - Rules against. If a new Rule requies a key that is missing, the attribute should + Rules against. If a new Rule requires a key that is missing, the attribute should be added to this class to make it available for use in linting. """ diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/models/workflow.py b/lint-workflow-v2/src/bitwarden_workflow_linter/models/workflow.py index 761f9f0c..9c909695 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/models/workflow.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/models/workflow.py @@ -15,7 +15,7 @@ class Workflow: """Represents an entire workflow in a GitHub Action workflow. This object contains all of the data that is required to run the current linting - Rules against. If a new Rule requies a key that is missing, the attribute should + Rules against. If a new Rule requires a key that is missing, the attribute should be added to this class to make it available for use in linting. See src/models/job.py for an example if the key in the workflow data does not map diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rule.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rule.py index 3149cf69..c48a8b6d 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rule.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rule.py @@ -9,7 +9,7 @@ class RuleExecutionException(Exception): - """Exeception for the Base Rule class.""" + """Exception for the Base Rule class.""" pass @@ -22,7 +22,7 @@ class Rule: settings: Optional[Settings] = None def fn(self, obj: Union[Workflow, Job, Step]) -> Tuple[bool, str]: - """Execute the Rule (this should be overriden in the extending class. + """Execute the Rule (this should be overridden in the extending class. Args: obj: @@ -58,7 +58,7 @@ def build_lint_message(self, message: str, obj: Union[Workflow, Job, Step]) -> s return f"{obj_type.__name__} => {message}" def execute(self, obj: Union[Workflow, Job, Step]) -> Union[LintFinding, None]: - """Wrapper function to execute the overriden self.fn(). + """Wrapper function to execute the overridden self.fn(). Run the Rule against the object and return the results. The result could be an Exception message where the Rule cannot be run against diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/job_environment_prefix.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/job_environment_prefix.py index 94040871..ec031752 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/job_environment_prefix.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/job_environment_prefix.py @@ -3,14 +3,14 @@ from typing import Union, Optional, Tuple, List from ..models.job import Job -from ..models.workflow import Workflow from ..models.step import Step +from ..models.workflow import Workflow from ..rule import Rule from ..utils import LintLevels, Settings class RuleJobEnvironmentPrefix(Rule): - """Rule to enforce specific prefixes for environemnt variables. + """Rule to enforce specific prefixes for environment variables. Automated testing is not easily written for GitHub Action Workflows. CI can also get complicated really quickly and take up hundreds of lines. All of this can @@ -29,10 +29,10 @@ def __init__(self, settings: Optional[Settings] = None) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ - self.message = "Job environment vars should start with and underscore:" + self.message = "Job environment vars should start with an underscore:" self.on_fail = LintLevels.ERROR self.compatibility = [Job] self.settings = settings @@ -57,7 +57,7 @@ def fn(self, obj: Job) -> Tuple[bool, str]: as in _TEST_ENV. See tests/rules/test_job_environment_prefix.py for examples of - incorrectly names environment variables. + incorrectly named environment variables. """ correct = True diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_capitalized.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_capitalized.py index 71cb2598..ac205542 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_capitalized.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_capitalized.py @@ -2,9 +2,9 @@ from typing import Optional, Tuple, Union -from ..models.workflow import Workflow from ..models.job import Job from ..models.step import Step +from ..models.workflow import Workflow from ..rule import Rule from ..utils import LintLevels, Settings @@ -20,7 +20,7 @@ def __init__(self, settings: Optional[Settings] = None) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.message = "name must capitalized" diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_exists.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_exists.py index 124214a9..ef261bfa 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_exists.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/name_exists.py @@ -1,4 +1,4 @@ -"""A Rule to enforce that a 'name' exists.""" +"""A Rule to enforce that a 'name' key exists.""" from typing import Optional, Tuple, Union @@ -10,7 +10,7 @@ class RuleNameExists(Rule): - """Rule to enforce a 'name' exists for every object in GitHub Actions. + """Rule to enforce a 'name' key exists for every object in GitHub Actions. For pipeline run troubleshooting and debugging, it is helpful to have a name to immediately identify a Workflow, Job, or Step while moving between @@ -24,7 +24,7 @@ def __init__(self, settings: Optional[Settings] = None) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.message = "name must exist" diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/pinned_job_runner.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/pinned_job_runner.py index fab50ce6..2301e991 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/pinned_job_runner.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/pinned_job_runner.py @@ -3,8 +3,8 @@ from typing import List, Optional, Tuple, Union from ..models.job import Job -from ..models.workflow import Workflow from ..models.step import Step +from ..models.workflow import Workflow from ..rule import Rule from ..utils import LintLevels, Settings @@ -12,7 +12,7 @@ class RuleJobRunnerVersionPinned(Rule): """Rule to enforce pinned Runner OS versions. - `*-latest` versions updating without knowing has broken all of our worklfows + Using `*-latest` versions will update automatically and broken all of our workflows in the past. To avoid this and prevent a single event from breaking the majority of our pipelines, we pin the versions. """ @@ -22,7 +22,7 @@ def __init__(self, settings: Optional[Settings] = None) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.message = "Workflow runner must be pinned" diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_approved.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_approved.py index 0b820438..ac6d831a 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_approved.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_approved.py @@ -3,8 +3,8 @@ from typing import List, Optional, Tuple, Union from ..models.job import Job -from ..models.workflow import Workflow from ..models.step import Step +from ..models.workflow import Workflow from ..rule import Rule from ..utils import LintLevels, Settings @@ -22,7 +22,7 @@ def __init__(self, settings: Optional[Settings] = None) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.on_fail = LintLevels.WARNING @@ -88,7 +88,7 @@ def fn(self, obj: Step) -> Tuple[bool, str]: if obj.uses and not obj.uses_path in self.settings.approved_actions: return False, ( f"New Action detected: {obj.uses_path}\nFor security purposes, " - "actions must be reviewed and on the pre-approved list" + "actions must be reviewed and be on the pre-approved list" ) action = self.settings.approved_actions[obj.uses_path] diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_pinned.py b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_pinned.py index c9b2bcac..295a3f70 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_pinned.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/rules/step_pinned.py @@ -20,7 +20,7 @@ class RuleStepUsesPinned(Rule): pipelines, we pin any use of an Action to a specific hash that has been verified and pre-approved after a security audit of the version of the Action. - All Internl Actions, should be pinned to 'main'. This prevents Renovate from + All Internal Actions, should be pinned to 'main'. This prevents Renovate from spamming a bunch of PRs across all of our repos when `bitwarden/gh-actions` is updated. """ @@ -30,7 +30,7 @@ def __init__(self, settings: Optional[Settings] = None) -> None: Args: settings: - A Settings object that contains any default, overriden, or custom settings + A Settings object that contains any default, overridden, or custom settings required anywhere in the application. """ self.on_fail = LintLevels.ERROR diff --git a/lint-workflow-v2/src/bitwarden_workflow_linter/utils.py b/lint-workflow-v2/src/bitwarden_workflow_linter/utils.py index 4d1cf2ee..c0e3c704 100644 --- a/lint-workflow-v2/src/bitwarden_workflow_linter/utils.py +++ b/lint-workflow-v2/src/bitwarden_workflow_linter/utils.py @@ -80,7 +80,7 @@ def __eq__(self, other: Self) -> bool: Another Action type object to compare Return - The state of eqaulity + The state of equality """ return ( self.name == other.name @@ -96,7 +96,7 @@ def __ne__(self, other: Self) -> bool: Another Action type object to compare Return - The negation of the state of eqaulity + The negation of the state of equality """ return not self.__eq__(other) @@ -121,7 +121,7 @@ def __init__( enabled_rules: Optional[list[str]] = None, approved_actions: Optional[dict[str, dict[str, str]]] = None, ) -> None: - """Settings object that can be overriden in settings.py. + """Settings object that can be overridden in settings.py. Args: enabled_rules: diff --git a/lint-workflow-v2/tests/conftest.py b/lint-workflow-v2/tests/conftest.py index 89ebcc46..af48cf42 100644 --- a/lint-workflow-v2/tests/conftest.py +++ b/lint-workflow-v2/tests/conftest.py @@ -1,3 +1,3 @@ -"""Shared configation for tests.""" +"""Shared configuration for tests.""" FIXTURE_DIR = "./tests/fixtures" diff --git a/lint-workflow-v2/tests/fixtures/test.yml b/lint-workflow-v2/tests/fixtures/test.yml index cd6b71a2..ca1af310 100644 --- a/lint-workflow-v2/tests/fixtures/test.yml +++ b/lint-workflow-v2/tests/fixtures/test.yml @@ -17,24 +17,18 @@ jobs: - name: Checkout repo uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v2.3.4 - - name: Login to Azure - uses: Azure/logi@77f1b2e3fb80c0e8645114159d17008b8a2e475a + + - name: Log in to Azure - CI subscription + uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} + creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - name: Retrieve secrets - id: retrieve-secrets - env: - KEYVAULT: bitwarden-prod-kv - SECRETS: | - crowdin-api-token - run: | - for i in ${SECRETS//,/ } - do - VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv) - echo "::add-mask::$VALUE" - echo "$i=$VALUE" >> $GITHUB_OUTPUT - done + - name: Retrieve GitHub PAT secrets + id: retrieve-secret-pat + uses: bitwarden/gh-actions/get-keyvault-secrets@main + with: + keyvault: "bitwarden-ci" + secrets: "crowdin-api-token" - uses: crowdin/github-action@e39093fd75daae7859c68eded4b43d42ec78d8ea # v1.3.2 env: diff --git a/lint-workflow-v2/tests/rules/test_job_environment_prefix.py b/lint-workflow-v2/tests/rules/test_job_environment_prefix.py index 4c3afbef..89ae7d5c 100644 --- a/lint-workflow-v2/tests/rules/test_job_environment_prefix.py +++ b/lint-workflow-v2/tests/rules/test_job_environment_prefix.py @@ -1,4 +1,4 @@ -"""Test src/rules/job_environment_prefix.""" +"""Test src/bitwarden_workflow_linter/rules/job_environment_prefix.""" import pytest diff --git a/lint-workflow-v2/tests/rules/test_name_capitalized.py b/lint-workflow-v2/tests/rules/test_name_capitalized.py index 6317987f..1e573b5b 100644 --- a/lint-workflow-v2/tests/rules/test_name_capitalized.py +++ b/lint-workflow-v2/tests/rules/test_name_capitalized.py @@ -1,4 +1,4 @@ -"""Test src/rules/name_capitalized.py.""" +"""Test src/bitwarden_workflow_linter/rules/name_capitalized.py.""" import pytest diff --git a/lint-workflow-v2/tests/rules/test_name_exists.py b/lint-workflow-v2/tests/rules/test_name_exists.py index 935acc79..02048dad 100644 --- a/lint-workflow-v2/tests/rules/test_name_exists.py +++ b/lint-workflow-v2/tests/rules/test_name_exists.py @@ -1,4 +1,4 @@ -"""Test src/rules/name_exists.py.""" +"""Test src/bitwarden_workflow_linter/rules/name_exists.py.""" import pytest diff --git a/lint-workflow-v2/tests/rules/test_pinned_job_runner.py b/lint-workflow-v2/tests/rules/test_pinned_job_runner.py index 9f23024c..5db43d0a 100644 --- a/lint-workflow-v2/tests/rules/test_pinned_job_runner.py +++ b/lint-workflow-v2/tests/rules/test_pinned_job_runner.py @@ -1,4 +1,4 @@ -"""Test src/rules/pinned_job_runner.py.""" +"""Test src/bitwarden_workflow_linter/rules/pinned_job_runner.py.""" import pytest diff --git a/lint-workflow-v2/tests/rules/test_step_approved.py b/lint-workflow-v2/tests/rules/test_step_approved.py index efa082e4..5f1f0942 100644 --- a/lint-workflow-v2/tests/rules/test_step_approved.py +++ b/lint-workflow-v2/tests/rules/test_step_approved.py @@ -1,4 +1,4 @@ -"""Test src/rules/step_approved.py.""" +"""Test src/bitwarden_workflow_linter/rules/step_approved.py.""" import pytest diff --git a/lint-workflow-v2/tests/rules/test_step_pinned.py b/lint-workflow-v2/tests/rules/test_step_pinned.py index cb5d7f06..b73e0c58 100644 --- a/lint-workflow-v2/tests/rules/test_step_pinned.py +++ b/lint-workflow-v2/tests/rules/test_step_pinned.py @@ -1,4 +1,4 @@ -"""Test src/rules/step_pinned.py.""" +"""Test src/bitwarden_workflow_linter/rules/step_pinned.py.""" import pytest diff --git a/lint-workflow-v2/tests/test_job.py b/lint-workflow-v2/tests/test_job.py index 0187d9d1..f0a91105 100644 --- a/lint-workflow-v2/tests/test_job.py +++ b/lint-workflow-v2/tests/test_job.py @@ -1,4 +1,4 @@ -"""Test src/models/job.py.""" +"""Test src/bitwarden_workflow_linter/models/job.py.""" import pytest diff --git a/lint-workflow-v2/tests/test_lint.py b/lint-workflow-v2/tests/test_lint.py index fad17139..68ce399c 100644 --- a/lint-workflow-v2/tests/test_lint.py +++ b/lint-workflow-v2/tests/test_lint.py @@ -1,4 +1,4 @@ -"""Test src/lint.py.""" +"""Test src/bitwarden_workflow_linter/lint.py.""" import pytest diff --git a/lint-workflow-v2/tests/test_load.py b/lint-workflow-v2/tests/test_load.py index 98640af4..cedc2017 100644 --- a/lint-workflow-v2/tests/test_load.py +++ b/lint-workflow-v2/tests/test_load.py @@ -1,4 +1,4 @@ -"""Tests src/load.py.""" +"""Tests src/bitwarden_workflow_linter/load.py.""" import pytest diff --git a/lint-workflow-v2/tests/test_rule.py b/lint-workflow-v2/tests/test_rule.py index 363e2eb8..44dba8c5 100644 --- a/lint-workflow-v2/tests/test_rule.py +++ b/lint-workflow-v2/tests/test_rule.py @@ -1,4 +1,4 @@ -"""Tests src/rule.py.""" +"""Tests src/bitwarden_workflow_linter/rule.py.""" import pytest from typing import Union diff --git a/lint-workflow-v2/tests/test_step.py b/lint-workflow-v2/tests/test_step.py index deda0f9a..23625d16 100644 --- a/lint-workflow-v2/tests/test_step.py +++ b/lint-workflow-v2/tests/test_step.py @@ -1,4 +1,4 @@ -"""Test src/models/step.py.""" +"""Test src/bitwarden_workflow_linter/models/step.py.""" import json import pytest diff --git a/lint-workflow-v2/tests/test_utils.py b/lint-workflow-v2/tests/test_utils.py index b80b9efa..baf75d2d 100644 --- a/lint-workflow-v2/tests/test_utils.py +++ b/lint-workflow-v2/tests/test_utils.py @@ -1,4 +1,4 @@ -"""Tests src/utils.py.""" +"""Tests src/bitwarden_workflow_linter/utils.py.""" from src.bitwarden_workflow_linter.utils import Action, Colors, LintFinding, LintLevels diff --git a/lint-workflow-v2/tests/test_workflow.py b/lint-workflow-v2/tests/test_workflow.py index 0c8b2d44..da35f1f2 100644 --- a/lint-workflow-v2/tests/test_workflow.py +++ b/lint-workflow-v2/tests/test_workflow.py @@ -1,4 +1,4 @@ -"""Test src/models/workflow.py.""" +"""Test src/bitwarden_workflow_linter/models/workflow.py.""" import pytest