Skip to content

Commit b0cf065

Browse files
authored
Merge pull request #57 from saadmk11/handle-sub-dir-actions
[Enhancement] Handle Updates for GitHub Actions that are Located Inside Sub-Directories
2 parents 962eec3 + f6e7f32 commit b0cf065

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/main.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import pprint
3-
import time
43
from collections.abc import Generator
54
from functools import cache, cached_property
65
from typing import Any
@@ -147,7 +146,11 @@ def _update_workflow(self, workflow_path: str) -> set[str]:
147146

148147
for action in all_actions:
149148
try:
150-
action_repository, current_version = action.split("@")
149+
action_location, current_version = action.split("@")
150+
# A GitHub Action can be in a subdirectory of a repository
151+
# e.g. `flatpak/flatpak-github-actions/flatpak-builder@v4`.
152+
# we only need `user/repo` part from action_repository
153+
action_repository = "/".join(action_location.split("/")[:2])
151154
except ValueError:
152155
gha_utils.warning(
153156
f'Action "{action}" is in a wrong format, '
@@ -166,7 +169,7 @@ def _update_workflow(self, workflow_path: str) -> set[str]:
166169
)
167170
continue
168171

169-
updated_action = f"{action_repository}@{new_version}"
172+
updated_action = f"{action_location}@{new_version}"
170173

171174
if action != updated_action:
172175
gha_utils.echo(f'Found new version for "{action_repository}"')

0 commit comments

Comments
 (0)