Skip to content

Update X IDs

Update X IDs #72

Workflow file for this run

name: Update X IDs
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: update-x-ids
cancel-in-progress: false
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout test
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: test
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Install Playwright Chromium
run: pnpm exec playwright install --with-deps chromium
- name: Update X query IDs
run: pnpm update-x-ids
- name: Detect changes
id: detect_changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "变更文件列表:"
git diff --name-only
fi
- name: Create or update PR from test to main
if: steps.detect_changes.outputs.changed == 'true'
uses: peter-evans/create-pull-request@v7
with:
# 如果仓库设置未开启 "Allow GitHub Actions to create and approve pull requests",
# 即使配置了 pull-requests: write,GITHUB_TOKEN 也不能创建 PR。
# 可添加 UPDATE_X_IDS_PR_TOKEN:fine-grained PAT,权限为 contents:write 和 pull_requests:write。
token: ${{ secrets.UPDATE_X_IDS_PR_TOKEN || github.token }}
branch: test
base: main
commit-message: "chore: update x ids"
title: "chore: update x ids"
body: |
自动更新 X query IDs。
- 来源:`Update X IDs` workflow
- 目标文件:`src/api/x.ts`
delete-branch: false