Skip to content

Update stackoverflow badge #227

Update stackoverflow badge

Update stackoverflow badge #227

Workflow file for this run

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
env:
UPDATE_BADGE: ${{ steps.update-badge.outputs.UPDATE_BADGE }}
FILES_TO_ADD: ${{ steps.update-badge.outputs.FILES_TO_ADD }}
COMMIT_INFO: ${{ steps.update-badge.outputs.COMMIT_INFO }}
if: env.UPDATE_BADGE == 'true'
run: |
git config --local user.email "gihub-bot.tobse.eu"
git config --local user.name "github-james"
git add $FILES_TO_ADD
git commit -m "πŸ€– Update Badge - $COMMIT_INFO" -a
- name: Push changes
env:
UPDATE_BADGE: ${{ steps.update-badge.outputs.UPDATE_BADGE }}
if: env.UPDATE_BADGE == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}