-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.25 KB
/
update-badge.yml
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
38
39
40
41
42
43
44
45
46
name: Update Badge
on:
push:
branches:
- main
paths:
- 'gym/lifts.txt'
jobs:
update-badge:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for all branches and tags
- name: Read value from file
id: read-value
run: |
VALUE=$(cat gym/lifts.txt)
echo "value=$VALUE" >> $GITHUB_ENV
- name: Update README.md with the new badge value
run: |
VALUE=${{ env.value }}
sed -i "s/Git_Lifts_💪-[^)]*/Git_Lifts_💪-${VALUE}-blue/" README.md
- name: Commit changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README.md
git commit -m "docs(ci): update git lift badge value 🏅"
- name: Pull latest changes
run: |
git pull origin main --rebase
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git push