You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support functions to authenticate as GitHub App
In particular, this adds a function to obtain the installation access
token for a given repository. This function will be used e.g. to trigger
GitHub workflow runs.
These functions are slightly edited versions of functions that have been
in use in https://github.com/git-for-windows/gfw-helper-github-app for
quite a while. But the test is new.
Signed-off-by: Johannes Schindelin <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,16 @@ Instead of pushing the code to Azure all the time, waiting until it is deployed,
21
21
22
22
To this end, [install the Azure Functions Core Tools (for performance, use Linux)](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=v4%2Clinux%2Ccsharp%2Cportal%2Cbash#install-the-azure-functions-core-tools, e.g. via [WSL](https://learn.microsoft.com/en-us/windows/wsl/)).
23
23
24
-
Then, configure [the `GITHUB_WEBHOOK_SECRET`variable](#some-environment-variables) locally, via [a `local.settings.json` file](https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-local#local-settings-file). The contents would look like this:
24
+
Then, configure [the `GITHUB_APP_ID`, `GITHUB_APP_PRIVATE_KEY` and `GITHUB_WEBHOOK_SECRET`variables](#some-environment-variables) locally, via [a `local.settings.json` file](https://learn.microsoft.com/en-us/azure/azure-functions/functions-develop-local#local-settings-file). The contents would look like this:
25
25
26
26
```json
27
27
{
28
28
"IsEncrypted": false,
29
29
"Values": {
30
30
"FUNCTIONS_WORKER_RUNTIME": "node",
31
31
"AzureWebJobsStorage": "<storage-key>",
32
+
"GITHUB_APP_ID": "<app-id>",
33
+
"GITHUB_APP_PRIVATE_KEY": "<private-key>",
32
34
"GITHUB_WEBHOOK_SECRET": "<webhook-secret>"
33
35
},
34
36
"Host": {
@@ -61,6 +63,8 @@ A few environment variables will have to be configured for use with the Azure Fu
61
63
62
64
Concretely, the environment variables `GITHUB_WEBHOOK_SECRET` and `GITGITGADGET_TRIGGER_TOKEN` (a Personal Access Token to trigger the Azure Pipelines) need to be set. For the first, a generated random string was used. The second one was [created](https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-a-pat) scoped to the Azure DevOps project `gitgitgadget` with the Build (read & execute) permissions.
63
65
66
+
Also, the `GITHUB_APP_ID` and `GITHUB_APP_PRIVATE_KEY` variables are needed in order to trigger GitHub workflow runs. These were obtained as part of registering the GitHub App.
67
+
64
68
### The repository
65
69
66
70
On https://github.com/, the `+` link on the top was pressed, and an empty, private repository was registered. Nothing was pushed to it yet.
0 commit comments