Skip to content

Commit a556668

Browse files
committed
Add detection for existing and new branch
1 parent f7785da commit a556668

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

entrypoint.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@
7272
github_slug,
7373
)
7474

75-
git_repo.git.checkout('HEAD', b=gh_branch)
75+
git_refs = git_repo.remotes.origin.refs
76+
git_refs_name = list(map(lambda x: str(x).split('/')[-1], git_refs))
77+
78+
logging.debug(git_refs_name)
79+
80+
if gh_branch not in git_refs_name:
81+
git_repo.git.checkout(b=gh_branch)
82+
else:
83+
git_repo.git.checkout(gh_branch)
7684

7785
# Generate metadata
7886
deb_file_handle = DebFile(filename=deb_file_path)
@@ -99,7 +107,6 @@
99107
)
100108
apt_action_metadata = list(map(lambda x: json.loads(x[0]), apt_action_metadata_str))
101109

102-
logging.debug(list(all_commit))
103110
logging.debug(all_apt_action_commit)
104111
logging.debug(apt_action_metadata_str)
105112

0 commit comments

Comments
 (0)