Skip to content

GitHub Self-Updating Repository Demo #75

GitHub Self-Updating Repository Demo

GitHub Self-Updating Repository Demo #75

Workflow file for this run

name: GitHub Self-Updating Repository Demo
on:
# Schedule workflow to run daily at midnight
schedule:
- cron: "0 0 * * *"
jobs:
report:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
# https://github.com/actions/checkout/tree/v3.0.2
uses: actions/checkout@v3
- name: Modify date and time
id: modify
run: |
day_of_week=$(date +%u)
if (( day_of_week == RANDOM % 7 + 1 )); then
echo "Triggering update for day: $(date)" >> README.md
cat README.md
echo "run=true" >> $GITHUB_OUTPUT
else
echo "run=false" >> $GITHUB_OUTPUT
fi
- name: Push to repository
if: ${{ steps.modify.outputs.run == 'true' }}
run: |
git config --global user.name "ZoreAnuj"
git config --global user.email "zoreanuj@gmail.com"
now=$(date)
git add -A
git commit -m "Auto Push on $now"
git push