Skip to content

Commit

Permalink
Fix workflow linter for bitwarden sm action (#179)
Browse files Browse the repository at this point in the history
* Check if bitwarden/gh-action is in path for sm-action to work in workflow linter

* Trying to fix

* FIx

* Update
  • Loading branch information
michalchecinski authored Jul 13, 2023
1 parent a30e9c3 commit 8fd4a3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/workflow-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
6 changes: 3 additions & 3 deletions lint-workflow/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)",
Expand Down

0 comments on commit 8fd4a3d

Please sign in to comment.