Skip to content

Commit cbb5e37

Browse files
Update random-commit.yml
1 parent 6a1cc4d commit cbb5e37

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

.github/workflows/random-commit.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
steps:
1212
- name: Checkout repo
1313
uses: actions/checkout@v3
14+
with:
15+
persist-credentials: false # Important! Disable default token so we can use PAT
1416

1517
- name: Generate random number (0-9)
1618
id: random
@@ -19,12 +21,13 @@ jobs:
1921
- name: Show random number
2022
run: echo "Random number was $RANDOM_NUMBER"
2123

22-
- name: Maybe commit (if number is 05)
24+
- name: Maybe commit (if number is 0-5)
2325
if: ${{ env.RANDOM_NUMBER <= 5 }}
2426
run: |
2527
echo "Logging activity at $(date)" >> activity.txt
2628
git config --global user.name "GitHub Bot"
2729
git config --global user.email "bot@example.com"
2830
git add activity.txt
2931
git commit -m "Random activity $(date)"
30-
git push https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}.git
32+
git remote set-url origin https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }}.git
33+
git push origin HEAD:main

0 commit comments

Comments
 (0)