Skip to content

Commit

Permalink
update-checker: Reset to base branch after doing an update
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Oct 20, 2024
1 parent c02819d commit efccd9d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions update-checker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/bin/bash

set -e

function reset_to_master() {
current_branch="$(git rev-parse --abbrev-ref HEAD)"

if [[ -n $(git status --porcelain) ]]; then
echo "Uncommitted changes present"
exit 1
fi

if [[ "$current_branch" == update-* ]]; then
echo "Resetting to master branch"
git checkout master
fi
}

# Args to pass to the data checker
args=("--update" "--never-fork")

Expand Down Expand Up @@ -29,8 +45,10 @@ for path in "${file_paths[@]}"; do
# running in a container and call the data checker directly.
if [[ ! -f /run/.containerenv && ! -f /.dockerenv ]]; then
flatpak run --filesystem="$(pwd)" org.flathub.flatpak-external-data-checker "${args[@]}" "$path"
reset_to_master
else
/app/flatpak-external-data-checker "${args[@]}" "$path"
reset_to_master
fi
done

0 comments on commit efccd9d

Please sign in to comment.