Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions .github/workflows/update-star-history.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ concurrency:
group: update-star-history
cancel-in-progress: true

env:
ASSETS_BRANCH: chart-assets

jobs:
update:
if: github.repository == 'Stack-Cairn/LiveAgent'
Expand All @@ -26,14 +29,15 @@ jobs:
GH_TOKEN: ${{ secrets.STARGAZER_GH_TOKEN }}
run: |
set -euo pipefail
mkdir -p "$RUNNER_TEMP/charts"
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
"$RUNNER_TEMP/charts/star-history-light.svg" \
"$RUNNER_TEMP/charts/star-history-dark.svg"

- name: Collect contributors
env:
Expand All @@ -45,24 +49,22 @@ jobs:
> "$RUNNER_TEMP/contributors.json"
python3 scripts/update-contributors.py \
"$RUNNER_TEMP/contributors.json" \
docs/images/contributors.svg
"$RUNNER_TEMP/charts/contributors.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
test -s docs/images/contributors.svg
test -s "$RUNNER_TEMP/charts/star-history-light.svg"
test -s "$RUNNER_TEMP/charts/star-history-dark.svg"
test -s "$RUNNER_TEMP/charts/contributors.svg"

- name: Commit and push changes
- name: Push charts to assets branch
run: |
set -euo pipefail
git add README.md README.zh-CN.md docs/images/star-history-light.svg docs/images/star-history-dark.svg docs/images/contributors.svg
if git diff --cached --quiet; then
echo "README charts are unchanged."
exit 0
fi
git switch --orphan "$ASSETS_BRANCH"
cp "$RUNNER_TEMP"/charts/*.svg .
git add star-history-light.svg star-history-dark.svg contributors.svg
git config user.name "coder-hhx"
git config user.email "houhaixu_email@163.com"
git commit -m "docs: refresh star history and contributors charts"
git push
git push --force origin "$ASSETS_BRANCH"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ Before submitting a PR, make sure all of the following checks pass (they match t
Thanks to everyone who has contributed to LiveAgent!

<a href="https://github.com/Stack-Cairn/LiveAgent/graphs/contributors">
<img src="docs/images/contributors.svg" alt="Contributors" />
<img src="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/contributors.svg" alt="Contributors" />
</a>

---
Expand All @@ -417,9 +417,9 @@ Thanks to everyone who has contributed to LiveAgent!
<a href="https://www.star-history.com/?repos=Stack-Cairn%2FLiveAgent&type=date&legend=top-left">

<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/images/star-history-dark.svg" />
<source media="(prefers-color-scheme: light)" srcset="docs/images/star-history-light.svg" />
<img alt="Star History Chart" src="docs/images/star-history-light.svg" />
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/star-history-dark.svg" />
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/star-history-light.svg" />
<img alt="Star History Chart" src="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/star-history-light.svg" />
</picture>
</a>

Expand Down
8 changes: 4 additions & 4 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ LiveAgent/
感谢所有为 LiveAgent 做出贡献的朋友们!

<a href="https://github.com/Stack-Cairn/LiveAgent/graphs/contributors">
<img src="docs/images/contributors.svg" alt="Contributors" />
<img src="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/contributors.svg" alt="Contributors" />
</a>

---
Expand All @@ -417,9 +417,9 @@ LiveAgent/
<a href="https://www.star-history.com/?repos=Stack-Cairn%2FLiveAgent&type=date&legend=top-left">

<picture>
<source media="(prefers-color-scheme: dark)" srcset="docs/images/star-history-dark.svg" />
<source media="(prefers-color-scheme: light)" srcset="docs/images/star-history-light.svg" />
<img alt="Star History Chart" src="docs/images/star-history-light.svg" />
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/star-history-dark.svg" />
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/star-history-light.svg" />
<img alt="Star History Chart" src="https://raw.githubusercontent.com/Stack-Cairn/LiveAgent/chart-assets/star-history-light.svg" />
</picture>
</a>

Expand Down
1 change: 0 additions & 1 deletion docs/images/contributors.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/images/star-history-dark.svg

This file was deleted.

1 change: 0 additions & 1 deletion docs/images/star-history-light.svg

This file was deleted.

Loading