Skip to content

Fetch JDK Links

Fetch JDK Links #85

name: Fetch JDK Links
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
- cron: '0 0 * * 4' # Every Thursday at 00:00 UTC
workflow_dispatch: # Allow manual trigger
push:
paths:
- 'landing-page/scripts/**'
- '.github/workflows/fetch-jdk-links.yml'
jobs:
fetch-and-update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
# 1. 设置 Python 环境 (已移除 cache 配置以修复报错)
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
# cache: 'pip' <-- 删除了这一行,因为没有 requirements.txt
# 2. 手动安装依赖
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
# 3. 执行 Python 脚本
# 注意:请确认你的脚本实际路径。
# 如果脚本在 landing-page/scripts/ 目录下且名为 fetch_jdks.py,则如下:
- name: Fetch JDK links
run: |
cd landing-page
python scripts/fetch_jdks.py
- name: Check for changes
id: git-check
run: |
git diff --exit-code landing-page/data/jdk.json || echo "changed=true" >> $GITHUB_OUTPUT
- name: Commit and push if changed
if: steps.git-check.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add landing-page/data/jdk.json
git commit -m "chore(data): update JDK links [skip ci]"
git push