Sync antd data #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync antd data | |
| on: | |
| schedule: | |
| - cron: '37 8 * * *' # Daily at UTC 08:37 (Beijing 16:37) | |
| workflow_dispatch: # Manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - run: npm ci | |
| - name: Clone antd repo (shallow, filter tree) | |
| run: | | |
| git clone --filter=tree:0 --no-checkout \ | |
| https://github.com/ant-design/ant-design.git antd-source | |
| - name: Sync v4, v5, v6 metadata | |
| run: npx tsx scripts/sync.ts --antd-dir antd-source | |
| - name: Commit and push if changed | |
| run: | | |
| if [ -z "$(git status --porcelain data/)" ]; then | |
| echo "No changes in data/" | |
| else | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| VERSIONS="" | |
| for major in 4 5 6; do | |
| if ! git diff --quiet "data/v${major}.json"; then | |
| VER=$(node -p "JSON.parse(require('fs').readFileSync(\"data/v${major}.json\",'utf8')).version") | |
| VERSIONS="${VERSIONS:+${VERSIONS}, }v${major}@${VER}" | |
| fi | |
| done | |
| git add data/ | |
| git commit -m "data: sync antd metadata${VERSIONS:+ (${VERSIONS})}" | |
| git push origin main | |
| fi |