-
Notifications
You must be signed in to change notification settings - Fork 2
44 lines (37 loc) · 1.22 KB
/
update-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
name: Update Data
on:
schedule:
- cron: '0 0 * * *' # Run every 24 hours at midnight
push:
branches:
- master # Replace with the branch you want
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run update script
run: ./update.sh
- name: Commit and push changes
run: |
git config user.name "Automated Update"
git config user.email "[email protected]"
git add -A
if [[ -n $(git status -s) ]]; then
git commit -m "Automated data update"
git push
else
echo "No changes to commit"
exit 0
fi
- name: Notify Discord if Success
if: success()
run: |
MESSAGE="Data update job completed. Status: ${{ job.status }}."
curl -H "Content-Type: application/json" -X POST -d "{\"content\": \"$MESSAGE\"}" ${{ secrets.DISCORD_WEBHOOK_URL }}
- name: Notify Discord if Failure
if: failure()
run: |
MESSAGE="Data update job failed. Status: ${{ job.status }}. <@&1146448179412348989>"
curl -H "Content-Type: application/json" -X POST -d "{\"content\": \"$MESSAGE\"}" ${{ secrets.DISCORD_WEBHOOK_URL }}