github.com/argoproj/argo-cd/v3@v3.2.1/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/api/v3 11 12 > ⚠️ _NOTE:_ Specifying `/api/v3` in the `enterpriseBaseURL` is required until [argoproj/notifications-engine#205](https://github.com/argoproj/notifications-engine/issues/205) is resolved. 13 14 ## Configuration 15 16 1. Create a GitHub Apps using https://github.com/settings/apps/new 17 1. Change repository permissions to enable write commit statuses and/or deployments and/or pull requests comments 18  19 1. Generate a private key, and download it automatically 20  21 1. Install app to account 22 1. Store privateKey in `argocd-notifications-secret` Secret and configure GitHub integration 23 in `argocd-notifications-cm` ConfigMap 24 25 ```yaml 26 apiVersion: v1 27 kind: ConfigMap 28 metadata: 29 name: argocd-notifications-cm 30 data: 31 service.github: | 32 appID: <app-id> 33 installationID: <installation-id> 34 privateKey: $github-privateKey 35 ``` 36 37 ```yaml 38 apiVersion: v1 39 kind: Secret 40 metadata: 41 name: <secret-name> 42 stringData: 43 github-privateKey: | 44 -----BEGIN RSA PRIVATE KEY----- 45 (snip) 46 -----END RSA PRIVATE KEY----- 47 ``` 48 49 6. Create subscription for your GitHub integration 50 51 ```yaml 52 apiVersion: argoproj.io/v1alpha1 53 kind: Application 54 metadata: 55 annotations: 56 notifications.argoproj.io/subscribe.<trigger-name>.github: "" 57 ``` 58 59 ## Templates 60 61  62 63 ```yaml 64 template.app-deployed: | 65 message: | 66 Application {{.app.metadata.name}} is now running new version of deployments manifests. 67 github: 68 repoURLPath: "{{.app.spec.source.repoURL}}" 69 revisionPath: "{{.app.status.operationState.syncResult.revision}}" 70 status: 71 state: success 72 label: "continuous-delivery/{{.app.metadata.name}}" 73 targetURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" 74 deployment: 75 state: success 76 environment: production 77 environmentURL: "https://{{.app.metadata.name}}.example.com" 78 logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" 79 requiredContexts: [] 80 autoMerge: true 81 transientEnvironment: false 82 reference: v1.0.0 83 pullRequestComment: 84 content: | 85 Application {{.app.metadata.name}} is now running new version of deployments manifests. 86 See more here: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true 87 commentTag: "continuous-delivery/{{.app.metadata.name}}" 88 checkRun: 89 name: "continuous-delivery/{{.app.metadata.name}}" 90 details_url: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true" 91 status: completed 92 conclusion: success 93 started_at: "YYYY-MM-DDTHH:MM:SSZ" 94 completed_at: "YYYY-MM-DDTHH:MM:SSZ" 95 output: 96 title: "Deployment of {{.app.metadata.name}} on ArgoCD" 97 summary: "Application {{.app.metadata.name}} is now running new version of deployments manifests." 98 text: | 99 Application {{.app.metadata.name}} is now running new version of deployments manifests. 100 See more here: {{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true 101 ``` 102 103 **Notes**: 104 105 - If the message is set to 140 characters or more, it will be truncated. 106 - If `github.repoURLPath` and `github.revisionPath` are same as above, they can be omitted. 107 - Automerge is optional and `true` by default for github deployments to ensure the requested ref is up to date with the default branch. 108 Setting this option to `false` is required if you would like to deploy older refs in your default branch. 109 For more information see the [GitHub Deployment API Docs](https://docs.github.com/en/rest/deployments/deployments?apiVersion=2022-11-28#create-a-deployment). 110 - If `github.pullRequestComment.content` is set to 65536 characters or more, it will be truncated. 111 - The `github.pullRequestComment.commentTag` parameter is used to identify the comment. If a comment with the specified tag is found, it will be updated (upserted). If no comment with the tag is found, a new comment will be created. 112 - Reference is optional. When set, it will be used as the ref to deploy. If not set, the revision will be used as the ref to deploy. 113