Skip to content

Update Star History & Contributors #1

Update Star History & Contributors

Update Star History & Contributors #1

name: Update Star History
on:
schedule:
- cron: "17 * * * *"
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: Refresh chart cache key
run: |
set -euo pipefail
cache_key="$(date -u +%Y-%m-%d-%H)"
sed -i -E "s/cache=[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}/cache=${cache_key}/g" README.md README.zh-CN.md
matches="$(grep -ho "cache=${cache_key}" README.md README.zh-CN.md | wc -l)"
test "$matches" -eq 6
- name: Commit and push changes
run: |
set -euo pipefail
if git diff --quiet -- README.md README.zh-CN.md; then
echo "Star History cache key is already current."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md README.zh-CN.md
git commit -m "docs: refresh star history chart"
git push