diff --git a/.gitea/workflows/agent.yml b/.gitea/workflows/agent.yml index 53e2d8e..0622d03 100644 --- a/.gitea/workflows/agent.yml +++ b/.gitea/workflows/agent.yml @@ -44,17 +44,6 @@ jobs: # job must never hold the single runner slot for hours. timeout-minutes: 45 steps: - - name: Acknowledge with 👀 - env: - GT: ${{ secrets.GITEA_TOKEN }} - CID: ${{ github.event.comment.id }} - NUM: ${{ github.event.issue.number }} - run: | - B="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/issues" - if [ -n "$CID" ]; then R="$B/comments/$CID/reactions"; else R="$B/$NUM/reactions"; fi - curl -sS -X POST -H "Authorization: token $GT" -H "Content-Type: application/json" \ - "$R" -d '{"content":"eyes"}' -w '\nreact -> HTTP %{http_code}\n' || true - - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -119,6 +108,19 @@ jobs: TOKEN_INTERN: ${{ secrets.TOKEN_INTERN }} run: bash "$SCRIPTS/route.sh" + - name: Acknowledge with 👀 (as the routed agent) + if: steps.prep.outputs.mode != 'skip' + env: + SELF_TOKEN: ${{ steps.prep.outputs.name == 'pm' && secrets.TOKEN_PM || steps.prep.outputs.name == 'junior' && secrets.TOKEN_JUNIOR || steps.prep.outputs.name == 'senior' && secrets.TOKEN_SENIOR || steps.prep.outputs.name == 'lead' && secrets.TOKEN_LEAD || steps.prep.outputs.name == 'qa' && secrets.TOKEN_QA || steps.prep.outputs.name == 'ops' && secrets.TOKEN_OPS || steps.prep.outputs.name == 'intern' && secrets.TOKEN_INTERN || '' }} + CID: ${{ github.event.comment.id }} + NUM: ${{ github.event.issue.number }} + run: | + [ -n "$SELF_TOKEN" ] || { echo "no agent token — skipping 👀"; exit 0; } + B="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/issues" + if [ -n "$CID" ]; then R="$B/comments/$CID/reactions"; else R="$B/$NUM/reactions"; fi + curl -sS -X POST -H "Authorization: token $SELF_TOKEN" -H "Content-Type: application/json" \ + "$R" -d '{"content":"eyes"}' -w '\nreact -> HTTP %{http_code}\n' || true + - name: Install opencode + provider config (+ Playwright MCP for browser agents) if: steps.prep.outputs.mode != 'skip' env: @@ -266,24 +268,27 @@ jobs: run: bash "$SCRIPTS/rescue-pr.sh" || true - name: Mark done with 🚀 (remove 👀) + if: steps.prep.outputs.mode != 'skip' env: - GT: ${{ secrets.GITEA_TOKEN }} + SELF_TOKEN: ${{ steps.prep.outputs.name == 'pm' && secrets.TOKEN_PM || steps.prep.outputs.name == 'junior' && secrets.TOKEN_JUNIOR || steps.prep.outputs.name == 'senior' && secrets.TOKEN_SENIOR || steps.prep.outputs.name == 'lead' && secrets.TOKEN_LEAD || steps.prep.outputs.name == 'qa' && secrets.TOKEN_QA || steps.prep.outputs.name == 'ops' && secrets.TOKEN_OPS || steps.prep.outputs.name == 'intern' && secrets.TOKEN_INTERN || '' }} CID: ${{ github.event.comment.id }} NUM: ${{ github.event.issue.number }} run: | + [ -n "$SELF_TOKEN" ] || exit 0 B="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/issues" if [ -n "$CID" ]; then R="$B/comments/$CID/reactions"; else R="$B/$NUM/reactions"; fi - curl -sS -X DELETE -H "Authorization: token $GT" -H "Content-Type: application/json" "$R" -d '{"content":"eyes"}' || true - curl -sS -X POST -H "Authorization: token $GT" -H "Content-Type: application/json" "$R" -d '{"content":"rocket"}' -w '\nreact -> HTTP %{http_code}\n' || true + curl -sS -X DELETE -H "Authorization: token $SELF_TOKEN" -H "Content-Type: application/json" "$R" -d '{"content":"eyes"}' || true + curl -sS -X POST -H "Authorization: token $SELF_TOKEN" -H "Content-Type: application/json" "$R" -d '{"content":"rocket"}' -w '\nreact -> HTTP %{http_code}\n' || true - name: Mark failed with 😕 (remove 👀) - if: failure() + if: failure() && steps.prep.outputs.mode != 'skip' env: - GT: ${{ secrets.GITEA_TOKEN }} + SELF_TOKEN: ${{ steps.prep.outputs.name == 'pm' && secrets.TOKEN_PM || steps.prep.outputs.name == 'junior' && secrets.TOKEN_JUNIOR || steps.prep.outputs.name == 'senior' && secrets.TOKEN_SENIOR || steps.prep.outputs.name == 'lead' && secrets.TOKEN_LEAD || steps.prep.outputs.name == 'qa' && secrets.TOKEN_QA || steps.prep.outputs.name == 'ops' && secrets.TOKEN_OPS || steps.prep.outputs.name == 'intern' && secrets.TOKEN_INTERN || '' }} CID: ${{ github.event.comment.id }} NUM: ${{ github.event.issue.number }} run: | + [ -n "$SELF_TOKEN" ] || exit 0 B="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/issues" if [ -n "$CID" ]; then R="$B/comments/$CID/reactions"; else R="$B/$NUM/reactions"; fi - curl -sS -X DELETE -H "Authorization: token $GT" -H "Content-Type: application/json" "$R" -d '{"content":"eyes"}' || true - curl -sS -X POST -H "Authorization: token $GT" -H "Content-Type: application/json" "$R" -d '{"content":"confused"}' -w '\nreact -> HTTP %{http_code}\n' || true + curl -sS -X DELETE -H "Authorization: token $SELF_TOKEN" -H "Content-Type: application/json" "$R" -d '{"content":"eyes"}' || true + curl -sS -X POST -H "Authorization: token $SELF_TOKEN" -H "Content-Type: application/json" "$R" -d '{"content":"confused"}' -w '\nreact -> HTTP %{http_code}\n' || true