Fix issue #44: Bug: until() uses naive datetime.now() — breaks with timezone-aware jobs #175
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: Relay Review Feedback | |
| on: | |
| pull_request_review: | |
| types: [submitted] | |
| jobs: | |
| relay: | |
| if: github.event.review.state == 'changes_requested' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check kill switch | |
| id: guard | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| # Kill switch: manual-review label stops all automation | |
| LABELS=$(gh api repos/${{ github.repository }}/issues/${PR_NUMBER}/labels --jq '.[].name' 2>/dev/null || echo "") | |
| if echo "$LABELS" | grep -q "manual-review"; then | |
| echo "Kill switch active — manual-review label found. Skipping." | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| - name: Check retry count | |
| if: steps.guard.outputs.skip != 'true' | |
| id: retry | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Count fix rounds | |
| if: steps.guard.outputs.skip != 'true' | |
| id: count | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| PR_NUMBER="${{ github.event.pull_request.number }}" | |
| BASE_SHA="${{ github.event.pull_request.base.sha }}" | |
| FIX_ROUNDS=$(git log --format='%an' ${BASE_SHA}..HEAD | grep -c "ghost-ship-ai\[bot\]" || echo "0") | |
| # Subtract 1 for the initial PR commit | |
| FIX_ROUNDS=$((FIX_ROUNDS > 0 ? FIX_ROUNDS - 1 : 0)) | |
| echo "fix_rounds=${FIX_ROUNDS}" >> "$GITHUB_OUTPUT" | |
| echo "Fix rounds so far: ${FIX_ROUNDS}" | |
| if [ "$FIX_ROUNDS" -ge 2 ]; then | |
| echo "Max fix rounds (2) reached. Escalating to manual review." | |
| gh issue comment "$PR_NUMBER" --repo "${{ github.repository }}" \ | |
| --body "This PR has been through 2 automated review rounds without resolution. Labeling for manual review." | |
| gh issue edit "$PR_NUMBER" --repo "${{ github.repository }}" --add-label "manual-review" | |
| echo "escalated=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "escalated=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Dispatch to Ghost Ship | |
| if: steps.guard.outputs.skip != 'true' && steps.count.outputs.escalated != 'true' | |
| run: | | |
| set -e | |
| HTTP_CODE=$(curl -s -o /tmp/dispatch_response -w "%{http_code}" -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.DISPATCH_TOKEN }}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${{ secrets.GHOST_SHIP_REPO }}/dispatches" \ | |
| -d '{ | |
| "event_type": "address-review", | |
| "client_payload": { | |
| "repo": "${{ github.repository }}", | |
| "pr_number": ${{ github.event.pull_request.number }} | |
| } | |
| }') | |
| if [ "$HTTP_CODE" -lt 200 ] || [ "$HTTP_CODE" -ge 300 ]; then | |
| echo "Dispatch failed with HTTP ${HTTP_CODE}:" | |
| cat /tmp/dispatch_response | |
| exit 1 | |
| fi | |
| echo "Dispatched address-review (HTTP ${HTTP_CODE})" |