mirror of
https://github.com/vinta/awesome-python.git
synced 2026-03-24 00:58:21 +08:00
ci: consolidate star fetch into deploy workflow using Actions cache
Replace the separate fetch-github-stars.yml workflow (which committed star data back to git) with an inline fetch step in deploy-website.yml. Star data is now stored in Actions cache between runs, eliminating the workflow_run trigger chain and the need to track github_stars.json in the repository. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
38
.github/workflows/deploy-website.yml
vendored
38
.github/workflows/deploy-website.yml
vendored
@@ -4,10 +4,8 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_run:
|
||||
workflows: ["Fetch GitHub Stars"]
|
||||
types: [completed]
|
||||
branches: [master]
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -20,7 +18,6 @@ concurrency:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.event_name == 'push' || github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
@@ -33,6 +30,37 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: uv sync --group build
|
||||
|
||||
- name: Restore star data cache
|
||||
id: cache-stars
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: website/data/github_stars.json
|
||||
key: github-stars-${{ github.run_id }}
|
||||
restore-keys: github-stars-
|
||||
|
||||
- name: Fetch GitHub stars
|
||||
if: github.event_name == 'schedule'
|
||||
id: fetch-stars
|
||||
continue-on-error: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: make fetch_github_stars
|
||||
|
||||
- name: Save star data cache
|
||||
if: steps.fetch-stars.outcome == 'success'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: website/data/github_stars.json
|
||||
key: github-stars-${{ github.run_id }}
|
||||
|
||||
- name: Verify star data exists
|
||||
run: |
|
||||
if [ ! -f website/data/github_stars.json ]; then
|
||||
echo "::error::github_stars.json not found. No cache and fetch failed or was skipped."
|
||||
exit 1
|
||||
fi
|
||||
echo "Star data found: $(wc -l < website/data/github_stars.json) lines"
|
||||
|
||||
- name: Build site
|
||||
run: make build
|
||||
|
||||
|
||||
39
.github/workflows/fetch-github-stars.yml
vendored
39
.github/workflows/fetch-github-stars.yml
vendored
@@ -1,39 +0,0 @@
|
||||
name: Fetch GitHub Stars
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
fetch:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --group build
|
||||
|
||||
- name: Fetch GitHub stars
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: make fetch_github_stars
|
||||
|
||||
- name: Commit updated star data
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git add website/data/github_stars.json
|
||||
if ! git diff --cached --quiet; then
|
||||
git commit -m "chore: update GitHub stars data"
|
||||
git push
|
||||
fi
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -7,6 +7,7 @@
|
||||
|
||||
# website
|
||||
website/output/
|
||||
website/data/github_stars.json
|
||||
|
||||
# claude code
|
||||
.claude/skills/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user