Skip to content

Instantly share code, notes, and snippets.

@lordofwizard
Created February 17, 2025 10:30
Show Gist options
  • Select an option

  • Save lordofwizard/4fa8e3e23f8d38017749cee4c40282ed to your computer and use it in GitHub Desktop.

Select an option

Save lordofwizard/4fa8e3e23f8d38017749cee4c40282ed to your computer and use it in GitHub Desktop.
This is a automatic git commit github workflow, it automatically commits 1-3 commits each weekday. on 12:30 PM UTC (feel free to change according to your requirements)
name: Auto Commit on Weekdays
on:
schedule:
- cron: '30 12 * * 1-5' # Runs at 12:30 PM UTC (Monday-Friday)
workflow_dispatch: # Allows manual trigger
jobs:
commit:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Configure Git with Your Credentials
run: |
git config --global user.name "YOUR_GITHUB_USERNAME"
git config --global user.email "YOUR_GITHUB_EMAIL"
- name: Generate Random Number of Commits
run: |
num_commits=$((RANDOM % 3 + 1)) # 1 to 3 commits
for i in $(seq 1 $num_commits); do
echo "$(date) - Random commit #$i" >> auto-commit.log
git add auto-commit.log
git commit -m "Automated commit #$i - $(date)"
done
- name: Push Changes
run: git push https://lordofwizard:${{ secrets.PAT_TOKEN }}@github.com/YOUR_GITHUB_USERNAME/YOUR_GITHUB_REPOSITORY.git main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment