forked from Hamza417/Inure
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (57 loc) · 2.58 KB
/
exodus_json_data.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Update Trackers JSON
on:
workflow_dispatch: # Allow manual triggering
schedule:
- cron: "0 0 * * 0" # Schedule to run every Sunday at midnight UTC (optional)
jobs:
exodus_data:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download JSON file
run: |
wget -O trackers.json https://reports.exodus-privacy.eu.org/api/trackers
- name: Parse JSON and create Android resource file
run: |
python - <<EOF
import json
json_file = 'trackers.json'
# Format the JSON file
with open(json_file, "r+", encoding="utf8") as file:
json_content = json.load(file)
json_content = json.dumps(json_content, indent=4, sort_keys=True)
file.seek(0)
file.write(json_content)
EOF
## Move trackers.json to app/src/main/resources
- name: Move Tracker JSON to Resources
run: |
if [ ! -d "./app/src/main/resources/" ]; then
mkdir -p ./app/src/main/resources/
fi
if [ -f "trackers.json" ]; then
echo "File exists, moving..."
fi
mv trackers.json ./app/src/main/resources/
if [ -f "./app/src/main/resources/trackers.json" ]; then
echo "File moved successfully."
fi
# Check for changes
- name: Check for changes
id: git-status
run: |
export GIT_STATUS=$(git status --porcelain)
echo "GIT_STATUS=$GIT_STATUS" >> $GITHUB_ENV
if [ -z "$GIT_STATUS" ]; then
echo "No changes detected..."
fi
# Commit changes to the repo
- name: Commit changes
if: env.GIT_STATUS != ''
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add .
git commit -m "Automated Exodus JSON data update"
git push origin master