From 5b7e2eb8484e7ed794149fa876b39f00c8123492 Mon Sep 17 00:00:00 2001
From: XargonWan <6771419+XargonWan@users.noreply.github.com>
Date: Sun, 9 Oct 2022 18:35:13 +0200
Subject: [PATCH] Cleaning old branch

---
 .github/workflows/flathub_push_cooker.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/flathub_push_cooker.yml b/.github/workflows/flathub_push_cooker.yml
index 98b48b84..5b74a4a2 100644
--- a/.github/workflows/flathub_push_cooker.yml
+++ b/.github/workflows/flathub_push_cooker.yml
@@ -40,7 +40,13 @@ jobs:
           #sync -rav --progress --exclude={'res/screenshots/','shared-modules/','rd-submodules/retroarch','.git/','docs','retrodeck-flatpak/','retrodeck-flatpak-cooker/','.flatpak-builder/'} ~/RetroDECK/ ~/flathub/
 
           cd $gits_folder/flathub
+
+          # cleaning the branch in case of a second run
+          git branch -d $relname
+          git push origin --delete $relname
+          
           git checkout -b $relname
+
           git rm -rf *
           git clean -fxd # restroing git index
 
@@ -80,7 +86,7 @@ jobs:
           git config --global user.email "${{ secrets.GITMAIL }}"
 
           git add *
-          git commit --ff -m "Updated flathub/net.retrodeck.retrodeck from RetroDECK/$rd_branch"
+          git commit -m "Updated flathub/net.retrodeck.retrodeck from RetroDECK/$rd_branch"
 
           git remote -v
           git push --force https://${{ secrets.TRIGGER_BUILD_TOKEN }}@github.com/flathub/net.retrodeck.retrodeck.git $relname
\ No newline at end of file