sync-clawhub #52
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-clawhub | |
| on: | |
| schedule: | |
| - cron: "0 2 * * *" | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Dry run mode (no actual changes)" | |
| required: false | |
| default: "false" | |
| type: choice | |
| options: | |
| - "true" | |
| - "false" | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Run sync script | |
| run: python scripts/sync_clawhub.py | |
| env: | |
| DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }} | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.check_changes.outputs.has_changes == 'true' && github.event.inputs.dry_run != 'true' | |
| run: | | |
| git config user.name "opencode-agent[bot]" | |
| git config user.email "opencode-agent[bot]@users.noreply.github.com" | |
| git add README.md | |
| git commit -m "chore(sync): update clawhub info in README [$(date +%Y-%m-%d)]" | |
| git pull --rebase --autostash origin "$GITHUB_REF_NAME" | |
| git push origin HEAD:"$GITHUB_REF_NAME" | |
| - name: Summary | |
| run: | | |
| echo "## ClawHub Sync Summary" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ steps.check_changes.outputs.has_changes }}" == "true" ]; then | |
| echo "✅ ClawHub info updated in README" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "ℹ️ No changes detected (clawhub may be up to date)" >> $GITHUB_STEP_SUMMARY | |
| fi |