github.com/argoproj/argo-cd/v2@v2.10.9/docs/operator-manual/notifications/services/github.md (about)

     1  # GitHub
     2  
     3  ## Parameters
     4  
     5  The GitHub notification service changes commit status using [GitHub Apps](https://docs.github.com/en/developers/apps) and requires specifying the following settings:
     6  
     7  * `appID` - the app id
     8  * `installationID` - the app installation id
     9  * `privateKey` - the app private key
    10  * `enterpriseBaseURL` - optional URL, e.g. https://git.example.com/
    11  
    12  ## Configuration
    13  
    14  1. Create a GitHub Apps using https://github.com/settings/apps/new
    15  2. Change repository permissions to enable write commit statuses and/or deployments and/or pull requests comments
    16  ![2](https://user-images.githubusercontent.com/18019529/108397381-3ca57980-725b-11eb-8d17-5b8992dc009e.png)
    17  3. Generate a private key, and download it automatically
    18  ![3](https://user-images.githubusercontent.com/18019529/108397926-d4a36300-725b-11eb-83fe-74795c8c3e03.png)
    19  4. Install app to account
    20  5. Store privateKey in `argocd-notifications-secret` Secret and configure GitHub integration
    21  in `argocd-notifications-cm` ConfigMap
    22  
    23  ```yaml
    24  apiVersion: v1
    25  kind: ConfigMap
    26  metadata:
    27    name: <config-map-name>
    28  data:
    29    service.github: |
    30      appID: <app-id>
    31      installationID: <installation-id>
    32      privateKey: $github-privateKey
    33  ```
    34  
    35  ```yaml
    36  apiVersion: v1
    37  kind: Secret
    38  metadata:
    39    name: <secret-name>
    40  stringData:
    41    github-privateKey: |
    42      -----BEGIN RSA PRIVATE KEY-----
    43      (snip)
    44      -----END RSA PRIVATE KEY-----
    45  ```
    46  
    47  6. Create subscription for your GitHub integration
    48  
    49  ```yaml
    50  apiVersion: argoproj.io/v1alpha1
    51  kind: Application
    52  metadata:
    53    annotations:
    54      notifications.argoproj.io/subscribe.<trigger-name>.github: ""
    55  ```
    56  
    57  ## Templates
    58  
    59  ![](https://user-images.githubusercontent.com/18019529/108520497-168ce180-730e-11eb-93cb-b0b91f99bdc5.png)
    60  
    61  ```yaml
    62  template.app-deployed: |
    63    message: |
    64      Application {{.app.metadata.name}} is now running new version of deployments manifests.
    65    github:
    66      repoURLPath: "{{.app.spec.source.repoURL}}"
    67      revisionPath: "{{.app.status.operationState.syncResult.revision}}"
    68      status:
    69        state: success
    70        label: "continuous-delivery/{{.app.metadata.name}}"
    71        targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
    72      deployment:
    73        state: success
    74        environment: production
    75        environmentURL: "https://{{.app.metadata.name}}.example.com"
    76        logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
    77        requiredContexts: []
    78        autoMerge: true
    79      pullRequestComment:
    80        content: |
    81          Application {{.app.metadata.name}} is now running new version of deployments manifests.
    82          See more here: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true
    83  ```
    84  
    85  **Notes**:
    86  - If the message is set to 140 characters or more, it will be truncated.
    87  - If `github.repoURLPath` and `github.revisionPath` are same as above, they can be omitted.
    88  - Automerge is optional and `true` by default for github deployments to ensure the requested ref is up to date with the default branch.
    89    Setting this option to `false` is required if you would like to deploy older refs in your default branch.
    90    For more information see the [GitHub Deployment API Docs](https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment).
    91  - If `github.pullRequestComment.content` is set to 65536 characters or more, it will be truncated.