|
| 1 | +name: ClawSweeper Proof Nudges |
| 2 | + |
| 3 | +run-name: ${{ github.event_name == 'schedule' && 'Scheduled proof nudges' || 'Manual proof nudges' }} |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + target_repo: |
| 9 | + description: "Repository to inspect for proof nudges" |
| 10 | + required: false |
| 11 | + default: "openclaw/openclaw" |
| 12 | + execute: |
| 13 | + description: "Post proof-nudge comments; false runs dry-run only" |
| 14 | + required: false |
| 15 | + default: "false" |
| 16 | + limit: |
| 17 | + description: "Maximum proof nudges to plan or post" |
| 18 | + required: false |
| 19 | + default: "10" |
| 20 | + min_age_days: |
| 21 | + description: "Minimum age in days since review/author activity before first proof nudge" |
| 22 | + required: false |
| 23 | + default: "5" |
| 24 | + cooldown_days: |
| 25 | + description: "Same-head cooldown in days between proof nudges" |
| 26 | + required: false |
| 27 | + default: "7" |
| 28 | + item_numbers: |
| 29 | + description: "Optional comma-separated PR numbers to inspect first" |
| 30 | + required: false |
| 31 | + default: "" |
| 32 | + schedule: |
| 33 | + - cron: "44 9 * * *" |
| 34 | + |
| 35 | +permissions: |
| 36 | + contents: read |
| 37 | + issues: write |
| 38 | + pull-requests: read |
| 39 | + |
| 40 | +env: |
| 41 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" |
| 42 | + CLAWSWEEPER_APP_CLIENT_ID: Iv23liOECG0slfuhz093 |
| 43 | + |
| 44 | +concurrency: |
| 45 | + group: ${{ format('clawsweeper-proof-nudges-{0}', github.event.inputs.target_repo || vars.CLAWSWEEPER_PROOF_NUDGES_TARGET_REPO || 'openclaw/openclaw') }} |
| 46 | + cancel-in-progress: false |
| 47 | + |
| 48 | +jobs: |
| 49 | + proof-nudges: |
| 50 | + name: Proof nudges |
| 51 | + if: ${{ github.event_name == 'workflow_dispatch' || (github.event_name == 'schedule' && vars.CLAWSWEEPER_PROOF_NUDGES_SCHEDULED == '1') }} |
| 52 | + runs-on: ubuntu-latest |
| 53 | + timeout-minutes: 60 |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v6 |
| 56 | + with: |
| 57 | + filter: blob:none |
| 58 | + fetch-depth: 0 |
| 59 | + |
| 60 | + - name: Resolve target repository |
| 61 | + id: target |
| 62 | + env: |
| 63 | + TARGET_REPO_INPUT: ${{ github.event.inputs.target_repo || vars.CLAWSWEEPER_PROOF_NUDGES_TARGET_REPO || 'openclaw/openclaw' }} |
| 64 | + run: | |
| 65 | + target_repo="$TARGET_REPO_INPUT" |
| 66 | + if [[ ! "$target_repo" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]; then |
| 67 | + echo "::error::target_repo must be owner/repo with GitHub-safe characters" |
| 68 | + exit 1 |
| 69 | + fi |
| 70 | + target_owner="${target_repo%%/*}" |
| 71 | + target_name="${target_repo#*/}" |
| 72 | + { |
| 73 | + echo "target_repo=$target_repo" |
| 74 | + echo "target_repo_owner=$target_owner" |
| 75 | + echo "target_repo_name=$target_name" |
| 76 | + } >> "$GITHUB_OUTPUT" |
| 77 | +
|
| 78 | + - name: Create target proof-nudge token |
| 79 | + id: target-proof-token |
| 80 | + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 |
| 81 | + with: |
| 82 | + client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }} |
| 83 | + private-key: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY }} |
| 84 | + owner: ${{ steps.target.outputs.target_repo_owner }} |
| 85 | + repositories: ${{ steps.target.outputs.target_repo_name }} |
| 86 | + permission-contents: read |
| 87 | + permission-issues: write |
| 88 | + permission-pull-requests: read |
| 89 | + |
| 90 | + - name: Create state token |
| 91 | + id: state-token |
| 92 | + uses: ./.github/actions/create-state-token |
| 93 | + with: |
| 94 | + client-id: ${{ env.CLAWSWEEPER_APP_CLIENT_ID }} |
| 95 | + private-key: ${{ secrets.CLAWSWEEPER_APP_PRIVATE_KEY }} |
| 96 | + |
| 97 | + - uses: ./.github/actions/setup-state |
| 98 | + with: |
| 99 | + token: ${{ steps.state-token.outputs.token }} |
| 100 | + |
| 101 | + - uses: ./.github/actions/setup-pnpm |
| 102 | + with: |
| 103 | + build-script: build:all |
| 104 | + |
| 105 | + - name: Run proof nudges |
| 106 | + env: |
| 107 | + GH_TOKEN: ${{ steps.target-proof-token.outputs.token }} |
| 108 | + TARGET_REPO: ${{ steps.target.outputs.target_repo }} |
| 109 | + PROOF_NUDGES_EXECUTE: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.execute == 'true') || (github.event_name == 'schedule' && vars.CLAWSWEEPER_PROOF_NUDGES_EXECUTE == '1') }} |
| 110 | + PROOF_NUDGES_ITEM_NUMBERS: ${{ github.event.inputs.item_numbers || '' }} |
| 111 | + PROOF_NUDGES_LIMIT: ${{ github.event.inputs.limit || vars.CLAWSWEEPER_PROOF_NUDGES_LIMIT || '10' }} |
| 112 | + PROOF_NUDGES_MIN_AGE_DAYS: ${{ github.event.inputs.min_age_days || vars.CLAWSWEEPER_PROOF_NUDGES_MIN_AGE_DAYS || '5' }} |
| 113 | + PROOF_NUDGES_COOLDOWN_DAYS: ${{ github.event.inputs.cooldown_days || vars.CLAWSWEEPER_PROOF_NUDGES_COOLDOWN_DAYS || '7' }} |
| 114 | + run: | |
| 115 | + set -euo pipefail |
| 116 | + for numeric_input in PROOF_NUDGES_LIMIT PROOF_NUDGES_MIN_AGE_DAYS PROOF_NUDGES_COOLDOWN_DAYS; do |
| 117 | + if [[ ! "${!numeric_input}" =~ ^[0-9]+$ ]]; then |
| 118 | + echo "::error::$numeric_input must be a non-negative integer" |
| 119 | + exit 1 |
| 120 | + fi |
| 121 | + done |
| 122 | +
|
| 123 | + execute_arg=() |
| 124 | + if [ "$PROOF_NUDGES_EXECUTE" = "true" ]; then |
| 125 | + execute_arg=(--execute) |
| 126 | + fi |
| 127 | + item_numbers_arg=() |
| 128 | + if [ -n "$PROOF_NUDGES_ITEM_NUMBERS" ]; then |
| 129 | + if [[ ! "$PROOF_NUDGES_ITEM_NUMBERS" =~ ^[0-9]+([[:space:]]*,[[:space:]]*[0-9]+)*$ ]]; then |
| 130 | + echo "::error::item_numbers must be a comma-separated list of pull request numbers" |
| 131 | + exit 1 |
| 132 | + fi |
| 133 | + item_numbers_arg=(--item-numbers "$PROOF_NUDGES_ITEM_NUMBERS") |
| 134 | + fi |
| 135 | + pnpm run proof-nudges -- \ |
| 136 | + --target-repo "$TARGET_REPO" \ |
| 137 | + --limit "$PROOF_NUDGES_LIMIT" \ |
| 138 | + --min-age-days "$PROOF_NUDGES_MIN_AGE_DAYS" \ |
| 139 | + --cooldown-days "$PROOF_NUDGES_COOLDOWN_DAYS" \ |
| 140 | + --report-path proof-nudge-report.json \ |
| 141 | + "${item_numbers_arg[@]}" \ |
| 142 | + "${execute_arg[@]}" |
| 143 | +
|
| 144 | + - uses: actions/upload-artifact@v7 |
| 145 | + if: ${{ always() }} |
| 146 | + with: |
| 147 | + name: proof-nudge-report |
| 148 | + path: proof-nudge-report.json |
| 149 | + if-no-files-found: ignore |
0 commit comments