kitchen-sink/.github/workflows/update-openclaw-sdk.yml
2026-04-29 00:59:41 -07:00

75 lines
3.2 KiB
YAML

name: Update OpenClaw SDK Surface
on:
schedule:
- cron: "*/10 * * * *"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: update-openclaw-sdk-surface
cancel-in-progress: false
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: 22
cache: npm
- run: npm install openclaw@latest --save-exact --package-lock
- run: npm install @openclaw/plugin-inspector@latest --save-dev --save-exact --package-lock
- run: npm run sync:surface
- run: npm test
- run: npm run plugin:inspect:runtime
- name: Open pull request
id: pull_request
env:
GH_TOKEN: ${{ github.token }}
run: |
if git diff --quiet package.json package-lock.json openclaw.plugin.json src/generated-hooks.js src/generated-registrars.js src/generated-sdk-imports.ts; then
echo "OpenClaw SDK surface is already current."
exit 0
fi
openclaw_version="$(node -p "require('./node_modules/openclaw/package.json').version")"
inspector_version="$(node -p "require('./node_modules/@openclaw/plugin-inspector/package.json').version")"
branch="automation/openclaw-fixture-deps-openclaw-${openclaw_version}-inspector-${inspector_version}-${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -B "$branch"
git add package.json package-lock.json openclaw.plugin.json src/generated-hooks.js src/generated-registrars.js src/generated-sdk-imports.ts
git commit -m "Update OpenClaw fixture dependencies"
git push origin "$branch"
pr_url="$(gh pr list --base main --head "$branch" --state open --json url --jq '.[0].url // ""')"
if [[ -z "$pr_url" ]]; then
pr_url="$(gh pr create \
--base main \
--head "$branch" \
--title "Update OpenClaw fixture dependencies" \
--body "Automated update of openclaw@${openclaw_version}, @openclaw/plugin-inspector@${inspector_version}, and the generated kitchen-sink API surface.")"
fi
echo "url=$pr_url" >> "$GITHUB_OUTPUT"
echo "openclaw_version=$openclaw_version" >> "$GITHUB_OUTPUT"
echo "inspector_version=$inspector_version" >> "$GITHUB_OUTPUT"
- name: Auto-merge pull request
if: ${{ steps.pull_request.outputs.url != '' }}
env:
GH_TOKEN: ${{ github.token }}
PR_URL: ${{ steps.pull_request.outputs.url }}
OPENCLAW_VERSION: ${{ steps.pull_request.outputs.openclaw_version }}
INSPECTOR_VERSION: ${{ steps.pull_request.outputs.inspector_version }}
run: |
gh pr merge "$PR_URL" \
--squash \
--delete-branch \
--subject "Update OpenClaw fixture dependencies" \
--body "Automated update of openclaw@${OPENCLAW_VERSION}, @openclaw/plugin-inspector@${INSPECTOR_VERSION}, and the generated kitchen-sink API surface."