Skip to content

Commit 792b378

Browse files
Create random-commit.yml
0 parents  commit 792b378

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

0 commit comments

Comments
 (0)