Skip to content

OpenClaw contract drift #42

OpenClaw contract drift

OpenClaw contract drift #42

name: OpenClaw contract drift
on:
schedule:
- cron: "0 9 * * *" # daily 09:00 UTC
workflow_dispatch:
pull_request:
paths:
- "packages/signet-openclaw-plugin/**"
- "scripts/check-openclaw-contract.mjs"
- ".github/workflows/openclaw-contract-check.yml"
permissions:
contents: read
issues: write
jobs:
check:
name: Check OpenClaw plugin SDK contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: "22"
- name: Run contract check
id: contract
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set +e
node scripts/check-openclaw-contract.mjs
code=$?
echo "exit_code=$code" >> "$GITHUB_OUTPUT"
# Pass through the exit code so the step's outcome reflects reality:
# 0 = clean
# 1 = drift (real failure, see "File issue on drift" step)
# 2 = infrastructure error (gh api flake, missing token, parse error)
exit "$code"
- name: File issue on drift
# Only on scheduled runs, only when the contract step itself produced
# exit code 1 (drift). Steps that fail before contract runs (checkout,
# setup-node, gh-api outage during fetch) leave outputs.exit_code empty,
# so this step is skipped and no false-positive issue is filed.
# `failure()` is required because GitHub Actions defaults to a
# `success()` guard, which would skip this step exactly in the drift
# case (the contract step exits 1 and marks the job failed).
if: failure() && github.event_name == 'schedule' && steps.contract.outputs.exit_code == '1'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
today=$(date -u +%F)
title="OpenClaw plugin SDK contract drift ($today)"
existing=$(gh issue list \
--label openclaw-contract-drift \
--state open \
--search "in:title \"OpenClaw plugin SDK contract drift\"" \
--json number \
--jq 'length')
if [ "$existing" != "0" ]; then
echo "Open drift issue already exists; skipping."
exit 0
fi
run_url="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
body=$(printf '%s\n%s\n\n%s\n%s\n\n%s\n' \
"The daily contract-drift check failed. Re-read packages/signet-openclaw-plugin/src/index.ts" \
"against the latest openclaw/openclaw main and decide:" \
"1. Update the *Like type interfaces and call sites to match the new SDK shape." \
"2. Bump openclaw.compat.pluginApi to exclude the OpenClaw build that introduced the drift." \
"Run logs: ${run_url}")
gh issue create \
--title "$title" \
--body "$body" \
--label openclaw-contract-drift