From adca60c3c7d259bd4f78d5047a2383986a0a208c Mon Sep 17 00:00:00 2001 From: JEFERSON FERREIRA DA SILVA Date: Sun, 10 May 2026 17:38:44 -0300 Subject: [PATCH] ci: bypass do gate pr-author-org-member para PRs de bots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adicionado para destravar PRs do Dependabot (e qualquer bot futuro como github-actions, Renovate). Bots não são "members" no sentido organizacional — endpoint /collaborators/{login}/permission retorna 404 para bot logins, fazendo o gate sempre falhar. Bypass explícito via github.event.pull_request.user.type == 'Bot' preserva a semântica para humanos: o step seguinte só roda quando type != 'Bot', mantendo a validação intacta de membership real (permission write/admin/maintain + não-outside-collaborator). Sem condicional, todos os PRs Dependabot ficariam bloqueados pelo status check obrigatório, exigindo --admin merge — anti-pattern. --- .github/workflows/pr-author-org-member.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/pr-author-org-member.yml b/.github/workflows/pr-author-org-member.yml index a299e2cd..db8b59f1 100644 --- a/.github/workflows/pr-author-org-member.yml +++ b/.github/workflows/pr-author-org-member.yml @@ -12,7 +12,21 @@ jobs: name: PR author is org member runs-on: ubuntu-latest steps: + # Bots conhecidos do GitHub (Dependabot, GitHub Actions, Renovate) + # não são "members" no sentido organizacional — não passam pelo endpoint + # /collaborators/{login}/permission e nem aparecem em ?affiliation=outside. + # São agentes do próprio GitHub, autorizados a abrir PRs com as permissões + # do repo via secrets.GITHUB_TOKEN. Bypass explícito + nominal evita + # reescrever o gate semanticamente: humanos continuam sendo validados + # pela rota normal abaixo. + - name: Bypass para bots do GitHub + if: github.event.pull_request.user.type == 'Bot' + run: | + echo "PR autor ${{ github.event.pull_request.user.login }} é Bot — bypass do gate org-member." + exit 0 + - name: Validate author is org member with write access + if: github.event.pull_request.user.type != 'Bot' env: AUTHOR: ${{ github.event.pull_request.user.login }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}