Merge pull request #41 from hanfamilym1/tool/resend #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |