mirror of
https://github.com/modelstudioai/skills.git
synced 2026-09-19 04:50:42 +08:00
101 lines
3.4 KiB
YAML
101 lines
3.4 KiB
YAML
# regenerate skills/bailian-cli/reference/ from modelstudioai/cli and open a PR.
|
|
|
|
name: Sync bailian-cli reference
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
cli_ref:
|
|
description: "Git ref (branch or tag) on modelstudioai/cli"
|
|
required: true
|
|
default: "main"
|
|
cli_repository:
|
|
description: "owner/repo (forks)"
|
|
required: true
|
|
default: "modelstudioai/cli"
|
|
|
|
concurrency:
|
|
group: sync-bailian-cli-reference
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
sync:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
steps:
|
|
- name: Checkout skills
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Checkout bailian-cli
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: ${{ inputs.cli_repository }}
|
|
ref: ${{ inputs.cli_ref }}
|
|
path: cli
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
cache-dependency-path: cli/pnpm-lock.yaml
|
|
|
|
- name: Install & generate reference (cli)
|
|
working-directory: cli
|
|
run: |
|
|
set -euo pipefail
|
|
pnpm install --frozen-lockfile
|
|
pnpm --filter bailian-cli-core run build
|
|
pnpm --filter bailian-cli run generate:reference
|
|
|
|
- name: Mirror into skills + update pin
|
|
run: |
|
|
set -euo pipefail
|
|
GEN="cli/tools/generated/reference"
|
|
OUT="skills/bailian-cli/reference"
|
|
mkdir -p "$OUT"
|
|
rsync -a --delete "$GEN/" "$OUT/"
|
|
printf '%s\n' "${{ inputs.cli_ref }}" > skills/bailian-cli/.reference-cli-ref
|
|
|
|
- name: Create pull request
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
CLI_REPO: ${{ inputs.cli_repository }}
|
|
CLI_REF: ${{ inputs.cli_ref }}
|
|
run: |
|
|
set -euo pipefail
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git add skills/bailian-cli/reference skills/bailian-cli/.reference-cli-ref
|
|
if git diff --staged --quiet; then
|
|
echo "No changes — skills reference already matches ${CLI_REPO}@${CLI_REF}"
|
|
exit 0
|
|
fi
|
|
BRANCH="chore/sync-bailian-cli-reference-${{ github.run_id }}"
|
|
git checkout -b "$BRANCH"
|
|
git commit -m "chore(bailian-cli): sync reference from ${CLI_REPO}@${CLI_REF}" \
|
|
-m "Generated by cli tools/generate-reference; .reference-cli-ref updated for Check workflow."
|
|
git push origin "HEAD:refs/heads/$BRANCH"
|
|
BODY="$(mktemp)"
|
|
{
|
|
echo "## Summary"
|
|
echo "- Synced \`skills/bailian-cli/reference/\` from \`${CLI_REPO}\` @ \`${CLI_REF}\` (cli: \`pnpm --filter bailian-cli run generate:reference\`)."
|
|
echo "- Updated \`skills/bailian-cli/.reference-cli-ref\` so **Check bailian-cli reference** validates against this ref."
|
|
echo ""
|
|
echo "## Test plan"
|
|
echo "- [ ] Merge after review; **Check bailian-cli reference** should pass on this PR."
|
|
} > "$BODY"
|
|
gh pr create \
|
|
--base "${{ github.event.repository.default_branch }}" \
|
|
--head "$BRANCH" \
|
|
--title "chore(bailian-cli): sync reference from ${CLI_REF}" \
|
|
--body-file "$BODY"
|
|
rm -f "$BODY"
|