---
title: Github Webhook
slug: homologacao-atmosphere/github-webhook
description: Learn how to effectively create and delete webhooks on GitHub with this comprehensive document. Discover the various parameters available, including active status, content type, events, GitHub URL, SSL verification, password, repository name, secret, stat
createdAt: 2021-03-16T17:47:59.000Z
---

## Resumo

- Criar e excluir webhooks do GitHub

## Parâmetros

| **Parâmetro**                        | **Tipo**               | **Escolhas \| Valor Padrão**                     | **Comentários**                                                                                                                                                                                  |
| ------------------------------------ | ---------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| active                               | boolean                | Escolhas:<br />- false<br />- true (default)     | Se o hook está ativo ou não                                                                                                                                                                      |
| content\_type                        | string                 | Escolhas:<br />- form (default)<br />- json      | O tipo de mídia usado para serializar as cargas úteis                                                                                                                                            |
| events                               | list / elements=string |                                                  | Uma lista de eventos do GitHub para os quais o hook é acionado. Os eventos estão listados em https\://developer.github.com/v3/activity/events/types/ . Obrigatório, a menos que `state = absent` |
| github\_url                          | string                 | Default:<br />"https\://api.github.com"          | URL base da API GitHub                                                                                                                                                                           |
| insecure\_ssl                        | boolean                | Escolhas:<br />- false (default)<br />- true     | Sinalize para indicar que o GitHub deve pular a verificação SSL ao chamar o hook.                                                                                                                |
| password                             | string                 |                                                  | Senha para autenticação no GitHub com                                                                                                                                                            |
| repository<br /><br />aliases: repo  | string                 |                                                  | Nome completo do repositório para configurar um hook                                                                                                                                             |
| secret                               | string                 |                                                  | O segredo compartilhado entre o GitHub e o payload URL.                                                                                                                                          |
| state                                | string                 | Escolhas:<br />- absent<br />- present (default) | Se o hook deve estar presente ou ausente                                                                                                                                                         |
| token                                | string                 |                                                  | Token para autenticação no GitHub com                                                                                                                                                            |
| url                                  | string                 |                                                  | URL para o qual as cargas serão entregues                                                                                                                                                        |
| user                                 | string                 |                                                  | Usuário para autenticação no GitHub                                                                                                                                                              |




## Exemplos

```yaml
# criar um novo webhook que dispara em push (autenticação por senha)
  github_webhook:
    repository: atmosphere/atmosphere
    url: https://www.example.com/hooks/
    events:
      - push
    user: "{{ github_user }}"
    password: "{{ github_password }}"

# criar um novo webhook em uma instalação corporativa do github com vários gatilhos de evento (autenticação de token)
  github_webhook:
    repository: myorg/myrepo
    url: https://jenkins.example.com/ghprbhook/
    content_type: json
    secret: "{{ github_shared_secret }}"
    insecure_ssl: True
    events:
      - issue_comment
      - pull_request
    user: "{{ github_user }}"
    token: "{{ github_user_api_token }}"
    github_url: https://github.example.com

# excluir um webhook (autenticação por senha)
  github_webhook:
    repository: atmosphere/atmosphere
    url: https://www.example.com/hooks/
    state: absent
    user: "{{ github_user }}"
    password: "{{ github_password }}"
```

## Valores Retornados

| **Chave** | **Tipo** | **Retornado quando** | **Descrição**                            |
| --------- | -------- | -------------------- | ---------------------------------------- |
| hook\_id  | integer  | state = present      | O ID do GitHub do hook criado/atualizado |





