From 19d13c4a140c43071cd4d9b130b176c2e5d8e9ad Mon Sep 17 00:00:00 2001 From: lucasbrentano Date: Wed, 1 Apr 2026 03:31:48 -0300 Subject: [PATCH] =?UTF-8?q?chore(ci):=20adicionar=20workflow=20de=20sincro?= =?UTF-8?q?niza=C3=A7=C3=A3o=20dev=20=E2=86=90=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cria PR automático (main → dev) sempre que um PR é mergeado na main, mantendo o histórico alinhado sem intervenção manual. Co-Authored-By: Claude --- .github/workflows/sync-dev.yml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/sync-dev.yml diff --git a/.github/workflows/sync-dev.yml b/.github/workflows/sync-dev.yml new file mode 100644 index 0000000..4d8ccca --- /dev/null +++ b/.github/workflows/sync-dev.yml @@ -0,0 +1,39 @@ +name: Sync dev with main + +on: + pull_request: + branches: [main] + types: [closed] + +jobs: + sync: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Create sync PR (main → dev) + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Verificar se já existe PR aberto de main → dev + EXISTING=$(gh pr list --base dev --head main --state open --json number --jq '.[0].number') + if [ -n "$EXISTING" ]; then + echo "PR #$EXISTING já existe (main → dev). Nada a fazer." + exit 0 + fi + + # Verificar se há diferença entre main e dev + DIFF=$(git log origin/dev..origin/main --oneline | head -1) + if [ -z "$DIFF" ]; then + echo "dev já está sincronizada com main. Nada a fazer." + exit 0 + fi + + gh pr create \ + --base dev \ + --head main \ + --title "chore: sincronizar dev com main" \ + --body "Sincronização automática após merge em main. Apenas merge commits — sem mudanças de código."