Auto Commit #2477
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Commit | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: "0 4,12,15,18,19,23 * * *" # Runs at 4 AM, 12 PM, 3 PM, 6 PM, 7 PM, 11 PM, and midnight UTC | |
jobs: | |
auto_commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Update Last Modified Timestamp | |
run: | | |
current_date=$(date '+%Y-%m-%dT%H:%M:%SZ') | |
echo $current_date > LAST_UPDATED | |
- name: Configure Git | |
run: | | |
git config --local user.name "XIN" | |
git config --local user.email "[email protected]" | |
- name: Commit Changes | |
run: | | |
git add -A | |
# Define commit messages | |
commit_messages=( | |
"chore(bot): π₯ auto commit" | |
"chore(bot): π auto commit" | |
"chore(bot): πΉ auto commit" | |
"chore(bot): πΊ auto commit" | |
"chore(bot): π€‘ auto commit" | |
"chore(bot): π» auto commit" | |
"chore(bot): π½ auto commit" | |
"chore(bot): π€ auto commit" | |
"chore(bot): πΎ auto commit" | |
"chore(bot): π auto commit" | |
) | |
# Select a random commit message | |
random_index=$(( RANDOM % ${#commit_messages[@]} )) | |
git commit -m "${commit_messages[$random_index]}" | |
- name: Push Changes | |
uses: ad-m/github-push-action@master | |
with: | |
force: true | |
directory: "." | |
github_token: ${{ secrets.GITHUB_TOKEN }} |