File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Random Activity
2+
3+ on :
4+ schedule :
5+ - cron : ' 0 6 * * *' # Runs daily at 6 AM UTC
6+ workflow_dispatch :
7+
8+ jobs :
9+ random-commit :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout repo
13+ uses : actions/checkout@v3
14+
15+ - name : Generate random number (0-9)
16+ id : random
17+ run : echo "RANDOM_NUMBER=$((RANDOM % 10))" >> $GITHUB_ENV
18+
19+ - name : Show random number
20+ run : echo "Random number was $RANDOM_NUMBER"
21+
22+ - name : Maybe commit (if number is 0-5)
23+ if : ${{ env.RANDOM_NUMBER <= 5 }}
24+ run : |
25+ echo "Logging activity at $(date)" >> activity.txt
26+ git config --global user.name "github-actions[bot]"
27+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
28+ git add activity.txt
29+ git commit -m "Random activity $(date)"
30+ git push
You can’t perform that action at this time.
0 commit comments