GIT_PULL - Atualizar Repositório Local
O que é este Node?
O GIT_PULL é o node responsável por atualizar um repositório local com as mudanças do repositório remoto. Ele executa o comando git pull para buscar e mesclar alterações.
Por que este Node existe?
Em automações que trabalham com código atualizado, precisamos sincronizar o repositório local com o remoto. O GIT_PULL existe para:
- Sincronização: Manter código local atualizado com o remoto
- Deploy: Obter última versão antes de fazer deploy
- Integração Contínua: Atualizar workspace de CI/CD
- Colaboração: Receber mudanças feitas por outros desenvolvedores
Como funciona internamente?
Quando o GIT_PULL é executado, o sistema:
- Valida repositório: Verifica se o path é um repositório Git válido
- Substitui variáveis: Aplica variáveis do contexto
- Executa pull: Roda
git pullno diretório especificado - Captura output: Obtém resultado do comando
- Se erro: Lança exceção (conflitos, sem conexão, etc)
- Se sucesso: Retorna confirmação e detalhes da atualização
Código interno (git.executor.ts:113-116):
private async pull(repoPath: string, context: ExecutionContext): Promise<any> {
const output = await this.execGit(repoPath, 'pull', context);
return { output, pulled: true };
}
Quando você DEVE usar este Node?
Use GIT_PULL sempre que precisar de sincronizar repositório local com remoto:
Casos de uso
- Deploy automatizado: "Antes de fazer deploy, preciso atualizar o código"
- Sincronização periódica: "A cada hora, atualizar repositório de documentação"
- Webhook handler: "Quando houver push no GitHub, atualizar local"
- Backup incremental: "Atualizar backup local com mudanças remotas"
Quando NÃO usar GIT_PULL
- Repositório não existe: Use GIT_CLONE primeiro
- Mudanças locais não commitadas: Resolva conflitos antes
- Branch diferente: Use comandos específicos de branch
Parâmetros Detalhados
repositoryPath (string, obrigatório)
O que é: Caminho absoluto para o repositório Git local que será atualizado.
Padrão: Nenhum (obrigatório informar)
Atenção:
- Deve ser um repositório Git válido (com pasta .git)
- Use paths absolutos: /home/user/projetos/meu-repo
- O usuário do processo deve ter permissões de escrita
Flow completo para testar:
{
"name": "Teste Git Pull - Repository Path",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "variable_1",
"type": "variable",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Definir Path",
"parameters": {
"variable": "repo_path",
"value": "/var/www/minha-app"
}
}
},
{
"id": "git_pull_1",
"type": "git",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Atualizar Repo",
"operation": "pull",
"repositoryPath": "{{repo_path}}",
"responseVariable": "pull_result"
}
},
{
"id": "message_1",
"type": "message",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Confirmar",
"parameters": {
"message": "Repositório atualizado!\nOutput: {{pull_result.output}}"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "variable_1" },
{ "source": "variable_1", "target": "git_pull_1" },
{ "source": "git_pull_1", "target": "message_1" },
{ "source": "message_1", "target": "end_1" }
]
}
Teste: Execute o flow. Sistema atualizará o repositório e mostrará o output do git pull.
responseVariable (string, opcional)
O que é: Nome da variável onde o resultado do pull será armazenado.
Padrão: Nenhum (resultado não é armazenado)
Estrutura do retorno:
{
"output": "Already up to date.\n",
"pulled": true
}
Flow completo para testar:
{
"name": "Teste Git Pull - Response Variable",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "git_pull_1",
"type": "git",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Pull com Variável",
"operation": "pull",
"repositoryPath": "/var/www/app",
"responseVariable": "pull_info"
}
},
{
"id": "condition_1",
"type": "condition",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Verificar Mudanças",
"parameters": {
"condition": "{{pull_info.output}}.includes('Already up to date')"
}
}
},
{
"id": "message_no_changes",
"type": "message",
"position": { "x": 700, "y": 50 },
"data": {
"label": "Sem Mudanças",
"parameters": {
"message": "Repositório já está atualizado"
}
}
},
{
"id": "message_updated",
"type": "message",
"position": { "x": 700, "y": 150 },
"data": {
"label": "Atualizado",
"parameters": {
"message": "Novas mudanças baixadas:\n{{pull_info.output}}"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "git_pull_1" },
{ "source": "git_pull_1", "target": "condition_1" },
{ "source": "condition_1", "target": "message_no_changes", "label": "true" },
{ "source": "condition_1", "target": "message_updated", "label": "false" },
{ "source": "message_no_changes", "target": "end_1" },
{ "source": "message_updated", "target": "end_1" }
]
}
Teste: Execute o flow. Sistema verifica se houve mudanças e mostra mensagem apropriada.
Parâmetros
| Campo | Tipo | Obrigatório | Descrição |
|---|---|---|---|
| operation | string | Sim | Deve ser "pull" |
| repositoryPath | string | Sim | Caminho do repositório local |
| responseVariable | string | Não | Variável para armazenar resultado |
Exemplo 1: Deploy com Atualização Automática
Objetivo: Atualizar código antes de fazer deploy de aplicação
JSON para Importar
{
"name": "Deploy com Git Pull",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "message_1",
"type": "message",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Aviso",
"parameters": {
"message": "Iniciando processo de deploy..."
}
}
},
{
"id": "git_pull_1",
"type": "git",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Atualizar Código",
"operation": "pull",
"repositoryPath": "/var/www/production",
"responseVariable": "pull_result"
}
},
{
"id": "message_2",
"type": "message",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Status Pull",
"parameters": {
"message": "Código atualizado:\n{{pull_result.output}}"
}
}
},
{
"id": "delay_1",
"type": "delay",
"position": { "x": 900, "y": 100 },
"data": {
"label": "Aguardar Build",
"parameters": {
"duration": 5000
}
}
},
{
"id": "message_3",
"type": "message",
"position": { "x": 1100, "y": 100 },
"data": {
"label": "Sucesso",
"parameters": {
"message": "Deploy concluído com sucesso!"
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1300, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "message_1" },
{ "source": "message_1", "target": "git_pull_1" },
{ "source": "git_pull_1", "target": "message_2" },
{ "source": "message_2", "target": "delay_1" },
{ "source": "delay_1", "target": "message_3" },
{ "source": "message_3", "target": "end_1" }
]
}
Saída esperada:
Sistema: Iniciando processo de deploy...
Sistema: Código atualizado:
From github.com:empresa/projeto
abc1234..def5678 main -> origin/main
Updating abc1234..def5678
Fast-forward
src/app.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
Sistema: Deploy concluído com sucesso!
Exemplo 2: Sincronização Periódica com Notificação
Objetivo: Verificar atualizações e notificar equipe se houver mudanças
JSON para Importar
{
"name": "Sincronização com Notificação",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "git_pull_1",
"type": "git",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Atualizar Docs",
"operation": "pull",
"repositoryPath": "/opt/documentation",
"responseVariable": "sync_result"
}
},
{
"id": "condition_1",
"type": "condition",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Tem Mudanças?",
"parameters": {
"condition": "!{{sync_result.output}}.includes('Already up to date')"
}
}
},
{
"id": "message_changes",
"type": "message",
"position": { "x": 700, "y": 50 },
"data": {
"label": "Notificar Mudanças",
"parameters": {
"message": "ATENÇÃO: Documentação foi atualizada!\n\nDetalhes:\n{{sync_result.output}}\n\nPor favor, revise as mudanças."
}
}
},
{
"id": "message_no_changes",
"type": "message",
"position": { "x": 700, "y": 150 },
"data": {
"label": "Sem Mudanças",
"parameters": {
"message": "Documentação sincronizada. Sem mudanças."
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 900, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "git_pull_1" },
{ "source": "git_pull_1", "target": "condition_1" },
{ "source": "condition_1", "target": "message_changes", "label": "true" },
{ "source": "condition_1", "target": "message_no_changes", "label": "false" },
{ "source": "message_changes", "target": "end_1" },
{ "source": "message_no_changes", "target": "end_1" }
]
}
Saída esperada (com mudanças):
Sistema: ATENÇÃO: Documentação foi atualizada!
Detalhes:
Updating 5e3a2b1..8f9c4d2
Fast-forward
docs/api.md | 45 +++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
Por favor, revise as mudanças.
Saída esperada (sem mudanças):
Sistema: Documentação sincronizada. Sem mudanças.
Exemplo 3: Pull com Tratamento de Erro
Objetivo: Atualizar repositório com tratamento de possíveis erros
JSON para Importar
{
"name": "Pull com Tratamento de Erro",
"nodes": [
{
"id": "start_1",
"type": "start",
"position": { "x": 100, "y": 100 },
"data": { "label": "Início" }
},
{
"id": "input_1",
"type": "input",
"position": { "x": 300, "y": 100 },
"data": {
"label": "Path do Repo",
"parameters": {
"message": "Digite o caminho do repositório:",
"variable": "repo_path"
}
}
},
{
"id": "git_status_1",
"type": "git",
"position": { "x": 500, "y": 100 },
"data": {
"label": "Verificar Status",
"operation": "status",
"repositoryPath": "{{repo_path}}",
"responseVariable": "status_check"
}
},
{
"id": "condition_1",
"type": "condition",
"position": { "x": 700, "y": 100 },
"data": {
"label": "Tem Mudanças Locais?",
"parameters": {
"condition": "{{status_check.status}}.includes('nothing to commit')"
}
}
},
{
"id": "git_pull_1",
"type": "git",
"position": { "x": 900, "y": 50 },
"data": {
"label": "Pull Seguro",
"operation": "pull",
"repositoryPath": "{{repo_path}}",
"responseVariable": "pull_result"
}
},
{
"id": "message_success",
"type": "message",
"position": { "x": 1100, "y": 50 },
"data": {
"label": "Sucesso",
"parameters": {
"message": "Pull realizado com sucesso!\n{{pull_result.output}}"
}
}
},
{
"id": "message_error",
"type": "message",
"position": { "x": 900, "y": 150 },
"data": {
"label": "Aviso",
"parameters": {
"message": "ATENÇÃO: Existem mudanças locais não commitadas.\nFaça commit antes de fazer pull."
}
}
},
{
"id": "end_1",
"type": "end",
"position": { "x": 1300, "y": 100 },
"data": { "label": "Fim" }
}
],
"edges": [
{ "source": "start_1", "target": "input_1" },
{ "source": "input_1", "target": "git_status_1" },
{ "source": "git_status_1", "target": "condition_1" },
{ "source": "condition_1", "target": "git_pull_1", "label": "true" },
{ "source": "condition_1", "target": "message_error", "label": "false" },
{ "source": "git_pull_1", "target": "message_success" },
{ "source": "message_success", "target": "end_1" },
{ "source": "message_error", "target": "end_1" }
]
}
Saída esperada (sem mudanças locais):
Usuário: /var/www/projeto
Sistema: Pull realizado com sucesso!
Already up to date.
Saída esperada (com mudanças locais):
Usuário: /var/www/projeto
Sistema: ATENÇÃO: Existem mudanças locais não commitadas.
Faça commit antes de fazer pull.
Resposta do Node
Sem mudanças:
{
"output": "Already up to date.",
"pulled": true
}
Com mudanças:
{
"output": "Updating abc1234..def5678\nFast-forward\n src/app.js | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)",
"pulled": true
}
Boas Práticas
✅ SIM:
- Verifique status antes do pull para evitar conflitos
- Use responseVariable para detectar se houve atualizações
- Configure credenciais SSH para evitar prompts de senha
- Faça pull regularmente para manter sincronização
- Trate possíveis erros de rede ou conflitos
- Use em conjunto com webhooks para pull automático
❌ NÃO:
- Não faça pull com mudanças locais não commitadas
- Não ignore erros de merge conflict
- Não execute pull em repositórios críticos sem backup
- Não faça pull durante horário de pico de produção
- Não execute pull sem verificar conectividade
- Não use pull em ambientes sem testes automatizados
Dicas
💡 Dica 1: Combine com GIT_STATUS para verificar estado antes do pull
💡 Dica 2: Use SCHEDULE node para criar pulls periódicos automatizados
💡 Dica 3: Integre com WEBHOOK para receber notificações de push do GitHub/GitLab
💡 Dica 4: Para ambientes de produção, faça backup antes de pull
💡 Dica 5: Use CONDITION para verificar se houve mudanças e acionar ações específicas
Próximo Node
→ GIT_PUSH - Enviar commits locais para remoto → GIT_STATUS - Verificar status antes do pull → GIT_FETCH - Buscar mudanças sem mesclar