mirror of
https://github.com/ashishpatel26/500-AI-Agents-Projects.git
synced 2026-09-02 22:34:04 +08:00
* fix: replace broken star-history.com chart with a self-generated one The chart in the README rendered as a broken image. The cause is upstream, not our URL: api.star-history.com returns 404 for this repo and 500 for facebook/react, so their API is failing generally. Every parameter variant I tried returned 404. Swapping to a different third-party chart service would just relocate the same dependency, so this generates the chart from the GitHub API instead - data we already own - and commits the SVG into the repo. The README now points at a local file that cannot 404. Rebuilding the curve does not need all 35k stargazers: requesting per_page=1&page=N returns exactly the Nth one, so 40 sampled points describe the shape just as well. That is ~40 API calls rather than ~350. The SVG carries a prefers-color-scheme block so it reads correctly in both GitHub themes, which the old two-source picture element never did - both its sources pointed at the same URL. Regenerates weekly and commits only when the chart actually changes. Ships with a self-check covering axis scaling, monotonicity, frame bounds and the zero-star case; CI runs it before every regeneration. Signed-off-by: ashishpatel26 <3095771+ashishpatel26@users.noreply.github.com> * fix: scope the star+json Accept header to the stargazers endpoint only Sourcery flagged this in review. application/vnd.github.star+json is only documented for the stargazers endpoint - it is what makes starred_at appear in the response. Sending it on /repos/{repo} too worked in testing, but relies on undocumented tolerance rather than the documented contract, and a future GitHub API change could break the metadata request for no reason related to what that header is for. Signed-off-by: ashishpatel26 <3095771+ashishpatel26@users.noreply.github.com> --------- Signed-off-by: ashishpatel26 <3095771+ashishpatel26@users.noreply.github.com> Co-authored-by: ashishpatel26 <3095771+ashishpatel26@users.noreply.github.com>
45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: Star History
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '30 2 * * 1' # Mondays, 02:30 UTC
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
concurrency:
|
|
group: star-history
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
regenerate:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Verify the generator still works
|
|
run: node scripts/star-history.mjs --self-check
|
|
|
|
- name: Regenerate chart
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: node scripts/star-history.mjs "$GITHUB_REPOSITORY" images/star-history.svg
|
|
|
|
- name: Commit if the chart changed
|
|
run: |
|
|
if git diff --quiet -- images/star-history.svg; then
|
|
echo "No change in star history, nothing to commit."
|
|
exit 0
|
|
fi
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add images/star-history.svg
|
|
# Signed off so the DCO check stays satisfied on any PR that includes this.
|
|
git commit -s -m "chore: refresh star history chart [skip ci]"
|
|
git push
|