Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ jobs:
;;
main|master)
case "$head" in
module/*|chore/*|docs/*|ci/*|fix/*|hotfix/*|style/*)
module/*|chore/*|docs/*|ci/*|fix/*|hotfix/*|style/*|dependabot/*)
echo "OK: '$head' -> '$base' permitido."
;;
*)
echo "::error::PR para '$base' deve vir de module/*, chore/*, docs/*, ci/*, fix/*, hotfix/* ou style/*. Recebido: '$head'."
echo "::error::PR para '$base' deve vir de module/*, chore/*, docs/*, ci/*, fix/*, hotfix/*, style/* ou dependabot/*. Recebido: '$head'."
exit 1
;;
esac
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
permissions:
contents: read
pull-requests: write
# issues: write — labels são sub-recurso de issues na API REST; sem
# isso o `gh label create` do job kind-label não cria label inexistente
# (caso de fork onde o Labels sync ainda não rodou).
issues: write

jobs:
# ── area/* e module/* por caminho ──────────────────────────────────
Expand All @@ -36,6 +40,7 @@ jobs:
- name: Derive kind/* from PR title
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
TITLE: ${{ github.event.pull_request.title }}
run: |
Expand All @@ -55,14 +60,15 @@ jobs:
exit 0
;;
esac
# Garante que a label exista antes de aplicá-la — gh pr edit
# --add-label falha se a label não existir no repo (caso de um
# fork onde o Labels sync ainda não rodou). O create sem --force
# não sobrescreve a label se ela já existir (cor/descrição
# ficam a cargo do labels.yml).
gh label create "$kind" --color 1d76db 2>/dev/null || true
# --repo explícito: este job não faz checkout, então não há
# diretório git pro `gh` inferir o repositório. Sem --repo, o
# `gh` falha com "not a git repository".
# gh label create best-effort: cria a label se não existir (cor
# e descrição definitivas ficam a cargo do labels.yml); não
# sobrescreve se já existir.
gh label create "$kind" --repo "$REPO" --color 1d76db 2>/dev/null || true
echo "Aplicando $kind"
gh pr edit "$PR" --add-label "$kind"
gh pr edit "$PR" --repo "$REPO" --add-label "$kind"

# ── size/* pelo volume de mudança ──────────────────────────────────
size-label:
Expand Down
Loading