Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
SeyedMuhammadHosseinMousavi authored Oct 21, 2024
1 parent 59f3e67 commit f257d2b
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1 @@
name: Update Watchers Count

on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch watchers count
run: |
WATCHERS_JSON=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -s "https://api.github.com/repos/SeyedMuhammadHosseinMousavi/CHFP-DVAE-Conditional-Hierarchical-Fuzzy-PSO-Disentangled-VAE/subscribers")
WATCHERS=$(echo "$WATCHERS_JSON" | jq '. | length')
echo "WATCHERS_COUNT=$WATCHERS"
echo "WATCHERS_COUNT=$WATCHERS" >> $GITHUB_ENV
- name: Display watchers count
run: echo "Number of Watchers: ${{ env.WATCHERS_COUNT }}"
- name: Update README
run: |
sed -i "s/Total Watchers:.*/Total Watchers: ${{ env.WATCHERS_COUNT }}/g" README.md
cat README.md
- name: Commit and push if changes
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
git add README.md
git commit -m "Updated Watchers Count" -a || echo "No changes to commit"
git push

0 comments on commit f257d2b

Please sign in to comment.