-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59f3e67
commit f257d2b
Showing
1 changed file
with
0 additions
and
30 deletions.
There are no files selected for viewing
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
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 |