diff --git a/automation_tools/flathub_push_main.sh b/automation_tools/flathub_push_main.sh index 3f243c04..7d914a33 100755 --- a/automation_tools/flathub_push_main.sh +++ b/automation_tools/flathub_push_main.sh @@ -98,9 +98,15 @@ git add . git commit -m "Update RetroDECK to v$relname from RetroDECK/$rd_branch" if [ -n "${GITHUB_WORKFLOW}" ]; then + + if ! git ls-remote --exit-code --heads origin "$relname"; then + echo "Branch $relname not found. Creating..." + git checkout -b "$relname" + git push -u origin "$relname" + fi + gh auth login --with-token <<< "${GITHUB_TOKEN}" gh repo set-default "${flathub_target_repo}" - gh repo create-branch --branch "$relname" gh repo sync --force --branch "$relname" else git push --force "https://github.com/${flathub_target_repo}" "$relname"