From 8fd4a3db744d323f6d4a043e9df4645bcaf0156e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ch=C4=99ci=C5=84ski?= Date: Thu, 13 Jul 2023 11:56:59 +0200 Subject: [PATCH] Fix workflow linter for bitwarden sm action (#179) * Check if bitwarden/gh-action is in path for sm-action to work in workflow linter * Trying to fix * FIx * Update --- .github/workflows/workflow-linter.yml | 2 +- lint-workflow/lint.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/workflow-linter.yml b/.github/workflows/workflow-linter.yml index ffcb1322..09d72b2b 100644 --- a/.github/workflows/workflow-linter.yml +++ b/.github/workflows/workflow-linter.yml @@ -32,7 +32,7 @@ jobs: - name: Workflow Lint env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: bitwarden/gh-actions/lint-workflow@606d9e0c8e15d92c7cc0d87be24781627a1330cd + uses: bitwarden/gh-actions/lint-workflow@e5f3566df3a05cfa8c2d9af99bd74b08c6ddb98d with: workflows: ${{ steps.changed-workflows.outputs.modified-workflows }} diff --git a/lint-workflow/lint.py b/lint-workflow/lint.py index a43046f7..62d33e83 100644 --- a/lint-workflow/lint.py +++ b/lint-workflow/lint.py @@ -97,7 +97,7 @@ def action_repo_exists(action_id): path, *hash = action_id.split("@") - if "bitwarden" in path: + if "bitwarden/gh-actions" in path: path_list = path.split("/", 2) url = f"https://api.github.com/repos/{path_list[0]}/{path_list[1]}" response = get_github_api_response(url, action_id) @@ -152,7 +152,7 @@ def get_action_update(action_id): if path in memoized_action_update_urls: return memoized_action_update_urls[path] else: - if "bitwarden" in path: + if "bitwarden/gh-actions" in path: path_list = path.split("/", 2) url = f"https://api.github.com/repos/{path_list[0]}/{path_list[1]}/commits?path={path_list[2]}" response = get_github_api_response(url, action_id) @@ -326,7 +326,7 @@ def lint(filename): # If the step has a 'uses' key, check path for external workflow path_list = path.split("/", 2) - if "bitwarden" in path and len(path_list) < 3: + if "bitwarden/gh-actions" in path and len(path_list) < 3: findings.append( LintFinding( f"Step {str(i)} of job key '{job_key}' does not have a valid action path. (missing name of the repository or workflow)",