refactor: Pump it up! π₯ #163
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 | |
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 |