Update update_clone_badge.yml #3
Workflow file for this run
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 Clone Badge | |
on: | |
#workflow_dispatch: # Manually trigger workflow | |
schedule: | |
- cron: '*/5 * * * *' # Runs every 5 minutes | |
push: | |
branches: | |
- v2.1.1-dev # Specify the branch you want to run the workflow on | |
#schedule: | |
# - cron: '0 0 * * *' # Runs at midnight every day | |
jobs: | |
update-badge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
node-version: '20.x' | |
- name: Get clone count | |
id: get_clone_count | |
run: | | |
# Fetch clone count from GitHub API | |
CLONE_COUNT=$(curl -s -H "Authorization: ***" \ | |
https://api.github.com/repos/CDCgov/phoenix/traffic/clones \ | |
| jq -r '.clones | if . == null then "0" else map(.count) | add | tostring end') | |
- name: Update README badge | |
run: | | |
sed -i "s/\[!\[GitHub Clones\]\(.*\)\]/[]()/g" README.md | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "HAISeq" | |
git add README.md | |
git commit -m "Update clone badge" | |
git push |