Create cron-job.sh
Browse files- cron-job.sh +15 -0
cron-job.sh
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# Git configuration
|
| 4 |
+
REPO_URL="https://${GITHUB_USERNAME}:${GITHUB_TOKEN}@github.com/${GIT_REPO}"
|
| 5 |
+
TARGET_DIR="/app/data/webui.db"
|
| 6 |
+
|
| 7 |
+
# Pull the latest changes from the repository
|
| 8 |
+
git -C $TARGET_DIR pull $REPO_URL
|
| 9 |
+
|
| 10 |
+
# Check if there are changes to commit
|
| 11 |
+
if [[ -n $(git -C $TARGET_DIR status -s) ]]; then
|
| 12 |
+
git -C $TARGET_DIR add .
|
| 13 |
+
git -C $TARGET_DIR commit -m "Automated commit of changes"
|
| 14 |
+
git -C $TARGET_DIR push $REPO_URL
|
| 15 |
+
fi
|