-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (32 loc) · 1.35 KB
/
daily-git-commit.yaml
File metadata and controls
38 lines (32 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: 🃏 Autocommit workflow
on:
schedule:
# Runs every day at 18:00 UTC
- cron: '0 18 * * *'
push:
branches: [ main ]
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: 🔍 Check out code
uses: actions/checkout@v2
- name: ⚡️ Update README
run: |
EMOJIS=(":smile:" ":laughing:" ":blush:" ":smiley:" ":relaxed:" ":smirk:" ":heart_eyes:" ":kissing_heart:" ":kissing_closed_eyes:" ":flushed:" ":relieved:" ":satisfied:" ":grin:" ":wink:" ":stuck_out_tongue_winking_eye:" ":stuck_out_tongue_closed_eyes:" ":grinning:" ":kissing:" ":kissing_smiling_eyes:" ":stuck_out_tongue:")
RANDOM_EMOJI=${EMOJIS[$RANDOM % ${#EMOJIS[@]}]}
sed -i "/$RANDOM_EMOJI/{s/| [0-9]* |/ $((`grep -o '[0-9]*' <<< $(grep $RANDOM_EMOJI README.md)`+1)) |/}" README.md
- name: ✅ Commit and push
run: |
if [[ "$(date +%Y)" -gt "2024" ]]; then
echo "It's now past 2024, stopping updates."
exit 0
fi
git config --local user.email "contacto@diegomarty.com"
git config --local user.name "DiegoMarty"
git remote set-url origin https://$GITHUB_TOKEN@github.com/diegomarty/daily-git-commit.git
git add README.md
git commit -m "🆕 New Emoji Added $RANDOM_EMOJI"
git push
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}