Skip to content

Automated Commit

Automated Commit #160

Workflow file for this run

name: Automated Commit
on:
push:
branches: [master] # Ensures the workflow triggers on pushes to master
schedule:
- cron: '0 */12 * * *' # Executes every 12 hours
workflow_dispatch: # Allows manual triggering from the GitHub UI
permissions:
contents: write # Grants permissions to write to the repo
jobs:
update_commit:
runs-on: ubuntu-latest # Specifies the runner
steps:
- name: Setup Debug Information
run: echo "::debug::Triggered by ref = ${{github.ref}}"
- name: Checkout Code
uses: actions/checkout@v3 # Latest version for optimized performance
with:
persist-credentials: true # Ensures credentials are available for subsequent steps
fetch-depth: 0 # Fetches all history for all branches and tags
- name: Update Timestamp File
run: |
current_time=$(date '+%Y-%m-%d %H:%M:%S')
echo "Updated on $current_time" > TIMESTAMP.txt
- name: Setup Git Configuration
run: |
git config user.email "[email protected]"
git config user.name "fuytalo"
- name: Prepare Commit
run: |
commit_messages=("Update: ⏰" "Refresh: πŸ”„" "Renew: 🌟" "Revise: πŸ“" "Amend: πŸ› " "Adjust: πŸ”§" "Change: πŸ“ˆ" "Modify: πŸ–Š" "Transform: πŸŒ€" "Revamp: 🌈")
random_msg=${commit_messages[$RANDOM % ${#commit_messages[@]}]}
git add TIMESTAMP.txt
git commit -m "$random_msg - $current_time" || echo "No changes to commit."
- name: GitHub Push
uses: ad-m/[email protected]
with:
directory: '.'
github_token: ${{ secrets.GITHUB_TOKEN }}