in converter.py [0:0]
def parse_approved_patterns(self, file):
allowlist = {}
allowed = yaml.safe_load(file)
for ap in allowed:
# Do some work to make sure that the names are right first, _then_ parse the tags
a = ap.split("/")
# Parse Docker things first
if a[0] == "docker:":
# action = self.build_dh_action(ap)
self.logger.log.critical("Parsing DockerHub entry")
dkey, image, tag = ap.split(":")
act = image.lstrip("//")
action = self.build_dh_action(act, tag)
# reset the action name to include the docker key `docker://`
act = "://".join([dkey, act])
# If it's not Docker it's GitHub
else:
# %s/%s
if len(a) == 2:
org = a[0]
if a[1] != "*":
repo = a[1]
else:
self.logger.log.critical(
f"Invalid Entry (No repo provided): {ap}"
)
continue
# %s, should not happen
elif len(a) == 1:
print(a)
# %s/%s/%s trunc'd to %s/%s
elif len(a) >= 3:
org = a[0]
repo = a[1]
act = f"{org}/{repo}"
if "@" in act:
act, tag = act.split("@")
else:
# In this case * is equivalent to HEAD of the default branch
tag = "*"
action = self.build_gh_action(act, tag)
if action:
# Update the allowlist
if act in self.allowlist:
allowlist[act].update(action)
else:
allowlist[act] = action
return allowlist