Skip to content

Commit 7936182

Browse files
committed
ci: Try harder to start x-checker from master always
1 parent bb75820 commit 7936182

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

update-checker.sh

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,9 @@
22

33
set -e
44

5-
git config --global --add safe.directory /github/workspace
6-
7-
function reset_to_master() {
8-
current_branch="$(git rev-parse --abbrev-ref HEAD)"
9-
10-
if [[ -n $(git status --porcelain) ]]; then
11-
echo "Uncommitted changes present"
12-
exit 1
13-
fi
5+
DEFAULT_BRANCH="master"
146

15-
if [[ "$current_branch" == update-* ]]; then
16-
echo "Resetting to master branch"
17-
git checkout master
18-
fi
19-
}
7+
git config --global --add safe.directory /github/workspace
208

219
# Args to pass to the data checker
2210
args=("--update" "--never-fork")
@@ -51,11 +39,12 @@ for path in "${file_paths[@]}"; do
5139
# If we're not running in a container, use the Flatpak. Else, assume we're
5240
# running in a container and call the data checker directly.
5341
if [[ ! -f /run/.containerenv && ! -f /.dockerenv ]]; then
42+
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
5443
flatpak run --filesystem="$(pwd)" org.flathub.flatpak-external-data-checker "${args[@]}" "$path" || true
55-
reset_to_master
44+
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
5645
else
46+
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
5747
/app/flatpak-external-data-checker "${args[@]}" "$path" || true
58-
reset_to_master
48+
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
5949
fi
6050
done
61-

0 commit comments

Comments
 (0)