Update Star History & Contributors #60
This file contains hidden or 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 Star History | |
| on: | |
| schedule: | |
| - cron: "17 * * * *" | |
| timezone: "Asia/Shanghai" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: update-star-history | |
| cancel-in-progress: true | |
| jobs: | |
| update: | |
| if: github.repository == 'Stack-Cairn/LiveAgent' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v6 | |
| - name: Collect stargazer history | |
| env: | |
| GH_TOKEN: ${{ secrets.STARGAZER_GH_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| gh api --paginate --slurp \ | |
| --header "Accept: application/vnd.github.star+json" \ | |
| "repos/${GITHUB_REPOSITORY}/stargazers?per_page=100" \ | |
| > "$RUNNER_TEMP/stargazers.json" | |
| python3 scripts/update-star-history.py \ | |
| "$RUNNER_TEMP/stargazers.json" \ | |
| docs/images/star-history-light.svg \ | |
| docs/images/star-history-dark.svg | |
| - name: Check chart files | |
| run: | | |
| set -euo pipefail | |
| test -s docs/images/star-history-light.svg | |
| test -s docs/images/star-history-dark.svg | |
| - name: Commit and push changes | |
| run: | | |
| set -euo pipefail | |
| git add README.md README.zh-CN.md docs/images/star-history-light.svg docs/images/star-history-dark.svg | |
| if git diff --cached --quiet; then | |
| echo "Star History charts are unchanged." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git commit -m "docs: refresh star history chart" | |
| git push |