-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (35 loc) · 1.2 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
name: Update Badge
on:
push:
branches:
- main # Change this to your default branch name
jobs:
updateBadge:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Git Config
run: |
git config --global user.email "${{ secrets.USER_EMAIL }}"
git config --global user.name "${{ secrets.USER_NAME }}"
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "14" # You can change the Node.js version as needed
- name: Install Dependencies
run: npm install
- name: Run JavaScript Script
run: |
node updateBadges.js "${{ secrets.OWNER }}" "${{ secrets.NAME }}" "${{ secrets.ACCESS_TOKEN }}"
- name: Check for Changes
run: |
if git diff --exit-code -- README.md; then
echo "No changes detected in README.md"
else
git config --global user.name "${{ secrets.OWNER }}"
git config --global user.email "${{ secrets.EMAIL }}" # Add your email secret here
git add README.md
git commit -m "Update badge in README.md"
git push
fi