Update stackoverflow badge #587
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 stackoverflow badge | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' # every day at midnight | |
jobs: | |
update-badge: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 15 | |
- run: npm ci | |
- id: update-badge | |
run: node ./update-badge-script.js | |
- name: Commit files | |
if: env.update-badge == 'true' | |
run: | | |
git config --local user.email "gihub-bot.tobse.eu" | |
git config --local user.name "github-james" | |
git add stackoverflow-badge.svg | |
git commit -m "π€ Update Badge" -a | |
- name: Push changes | |
if: env.update-badge == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |