Scheduled Commit Bot #48
This file contains hidden or 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: Scheduled Commit Bot | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Git | |
run: | | |
git config --global user.name 'rahfianugerah' | |
git config --global user.email 'nrahfia@gmail.com' | |
- name: Random number generation | |
id: random | |
# Generates a random number between 1 to 2 | |
run: echo "::set-output name=random_number::$(shuf -i 1-2 -n 1)" | |
- name: Make commits | |
run: | | |
for ((i=0; i<${{ steps.random.outputs.random_number }}; i++)); do | |
echo "$(date)" >> commit.txt | |
git add commit.txt | |
git commit -m "Automated Commit at $(date)" | |
done | |
git push |