-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathupdate-checker.sh
More file actions
executable file
·50 lines (42 loc) · 1.56 KB
/
update-checker.sh
File metadata and controls
executable file
·50 lines (42 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
set -e
DEFAULT_BRANCH="master"
git config --global --add safe.directory /github/workspace
# Args to pass to the data checker
args=("--update" "--never-fork")
# Format: "./path/to/manifest_file.json"
exclusions=()
# Initialize an array to store file paths
file_paths=()
# Iterate over directories next to the script
for dir in ./*/; do
# Search for files with the extensions .yaml, .yml, and .json
files=("$dir"*.yaml "$dir"*.yml "$dir"*.json)
# Iterate over the files
for file in "${files[@]}"; do
# Check if the file exists and contains "x-checker-data"
if [[ -f "$file" ]] && grep -q "x-checker-data" "$file"; then
# Add the file path to the array
file_paths+=("$file")
fi
done
done
# Print the file paths in the array
for path in "${file_paths[@]}"; do
if [[ " ${exclusions[*]} " == *" $path "* ]]; then
echo "Skipping excluded file: $path"
continue
fi
echo "Running data checker on: $path"
# If we're not running in a container, use the Flatpak. Else, assume we're
# running in a container and call the data checker directly.
if [[ ! -f /run/.containerenv && ! -f /.dockerenv ]]; then
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
flatpak run --filesystem="$(pwd)" org.flathub.flatpak-external-data-checker "${args[@]}" "$path" || true
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
else
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
/app/flatpak-external-data-checker "${args[@]}" "$path" || true
git switch -fC "$DEFAULT_BRANCH" origin/"$DEFAULT_BRANCH"
fi
done