name: PR Ready Gate on: pull_request: types: [synchronize] jobs: clear-labels: runs-on: ubuntu-24.04 if: | contains(github.event.pull_request.labels.*.name, 'ready') || contains(github.event.pull_request.labels.*.name, 'self-reviewed') steps: - name: Remove ready and self-reviewed labels, reassign to author env: GITEA_TOKEN: ${{ secrets.RODIN_TOKEN }} run: | PR_NUMBER=${{ github.event.pull_request.number }} AUTHOR=${{ github.event.pull_request.user.login }} READY_LABEL_ID=38 SELF_REVIEWED_LABEL_ID=37 # Remove ready label if present curl -sS -X DELETE \ -H "Authorization: token $GITEA_TOKEN" \ "https://gitea.weiker.me/api/v1/repos/${{ github.repository }}/issues/${PR_NUMBER}/labels/${READY_LABEL_ID}" || true # Remove self-reviewed label if present curl -sS -X DELETE \ -H "Authorization: token $GITEA_TOKEN" \ "https://gitea.weiker.me/api/v1/repos/${{ github.repository }}/issues/${PR_NUMBER}/labels/${SELF_REVIEWED_LABEL_ID}" || true # Reassign to author curl -sS -X PATCH \ -H "Authorization: token $GITEA_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"assignees\": [\"${AUTHOR}\"]}" \ "https://gitea.weiker.me/api/v1/repos/${{ github.repository }}/pulls/${PR_NUMBER}" echo "Cleared ready/self-reviewed labels and reassigned PR #${PR_NUMBER} to ${AUTHOR}"