Skip to content

Update Star Count

Update Star Count #1

Workflow file for this run

name: Update Star Count
on:
schedule:
- cron: '0 0 * * *' # Runs at 00:00 UTC every day
workflow_dispatch: # Allows manual trigger
jobs:
update-stars:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Get star count
id: stars
run: |
STARS=$(curl -s https://api.github.com/repos/pli-princeton/agentslack | jq .stargazers_count)
echo "STAR_COUNT=$STARS" >> $GITHUB_ENV
- name: Update README
run: |
sed -i "/🎵 Look, I was gonna get stars/c\<i>🎵 Look, I was gonna get stars (we've got ${{ env.STAR_COUNT }} now!)<br>" README.md
- name: Commit and push if changed
run: |
git config --global user.name 'Benedikt Stroebl'
git config --global user.email '[email protected]'
git add README.md
git diff --quiet && git diff --staged --quiet || (git commit -m "Update star count to ${{ env.STAR_COUNT }}" && git push)