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
Copy file name to clipboardExpand all lines: README.md
+51-23Lines changed: 51 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,16 +64,40 @@ The App listens to the following webhook events:
64
64
If you rename a `<repo.yml>` that corresponds to a repo, safe-settings will rename the repo to the new name. This behavior will take effect whether the env variable `BLOCK_REPO_RENAME_BY_HUMAN` is set or not.
65
65
66
66
### Restricting `safe-settings` to specific repos
67
-
`safe-settings` can be turned on only to a subset of repos by specifying them in the runtime settings file, `deployment-settings.yml`. If no file is specified, then the following repositories - `'admin', '.github', 'safe-settings'` are exempted by default.
68
-
A sample of `deployment-settings` file is found [here](docs/sample-settings/sample-deployment-settings.yml).
69
-
70
-
To apply `safe-settings`__only__ to a specific list of repos, add them to the `restrictedRepos` section as `include` array.
71
67
72
-
To ignore `safe-settings` for a specific list of repos, add them to the `restrictedRepos` section as `exclude` array.
68
+
To restrict which repositories `safe-settings` can manage, create a `deployment-settings.yml` file. This file controls the app's scope through the `restrictedRepos` configuration:
69
+
70
+
```yml
71
+
# Using include/exclude
72
+
restrictedRepos:
73
+
include:
74
+
- api
75
+
- core-* # Matches `core-api`, `core-service`, etc.
76
+
exclude:
77
+
- admin
78
+
- .github
79
+
- safe-settings
80
+
- test-* # Matches `test-repo`, etc.
81
+
82
+
# Or using simple array syntax for includes
83
+
restrictedRepos:
84
+
- admin
85
+
- .github
86
+
# ...
87
+
```
73
88
74
89
> [!NOTE]
75
-
> The `include` and `exclude` attributes support as well regular expressions.
76
-
> By default they look for regex, Example include: ['SQL'] will look apply to repos with SQL and SQL_ and SQL- etc if you want only SQL repo then use include:['^SQL$']
90
+
> Pattern matching uses glob expressions, e.g use * for wildcards.
91
+
92
+
When using `include` and `exclude`:
93
+
94
+
- If `include` is specified, will **only** run on repositories that match pattern(s)
95
+
- If `exclude` is specified, will run on all repositories **except** those matching pattern(s)
96
+
- If both are specified, will run only on included repositories that are'nt excluded
97
+
98
+
By default, if no configuration file is provided, `safe-settings` will excludes these repos: `admin`, `.github` and `safe-settings`.
99
+
100
+
See our [deployment-settings.yml sample](docs/sample-settings/sample-deployment-settings.yml).
77
101
78
102
### Custom rules
79
103
@@ -329,24 +353,28 @@ The following can be configured:
> It is possible to provide an `include` or `exclude` settings to restrict the `collaborators`, `teams`, `labels` to a list of repos or exclude a set of repos for a collaborator.
334
-
> The include/exclude pattern can also be for glob. For e.g.:
335
-
```
336
-
teams:
337
-
- name: Myteam-admins
338
-
permission: admin
339
-
- name: Myteam-developers
340
-
permission: push
341
-
- name: Other-team
342
-
permission: push
343
-
include:
344
-
- '*-config'
345
-
```
346
-
> Will only add `Other-team` to only `*-config` repos
347
-
348
356
See [`docs/sample-settings/settings.yml`](docs/sample-settings/settings.yml) for a sample settings file.
349
357
358
+
> [!note]
359
+
> When using `collaborators`, `teams` or `labels`, you can control which repositories they apply to using `include` and `exclude`:
360
+
>
361
+
> - If `include` is specified, settings will **only** apply to repositories that match those patterns
362
+
> - If `exclude` is specified, settings will apply to all repositories **except** those matching the patterns
363
+
> - If both are specified, `exclude` takes precedence over `include` but `include` patterns will still be respected
364
+
>
365
+
> Pattern matching uses glob expressions, e.g use * for wildcards. For example:
Copy file name to clipboardExpand all lines: docs/deploy.md
+24-14Lines changed: 24 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,42 +54,48 @@ Optional values in the .env file can be found under the [Environment variables](
54
54
55
55
Once you have the `.env` file configured, you are ready to start the building of the container.
56
56
57
-
###Docker
58
-
####Build the Docker container
57
+
## Docker
58
+
### Build the Docker container
59
59
Once you have configured the **GitHub App** and updated the source code, you should be ready to build the container.
60
60
- Change directory to inside the code base
61
61
-`cd safe-settings/`
62
62
- Build the container
63
63
-`docker build -t safe-settings .`
64
64
- This process should complete successfully and you will then have a **Docker** container ready for deployment
65
65
66
-
####Run the Docker container
66
+
### Run the Docker container
67
67
Once the container has been successfully built, you can deploy it and start utilizing the **GitHub App**.
68
68
69
-
####Start the container with docker-compose
69
+
### Start the container with docker-compose
70
70
If you have docker-compose installed, you can simply start and stop the **Docker** container with:
71
71
-`cd safe-settings/; docker-compose --env-file .env up -d`
72
72
This will start the container in the background and detached.
73
73
74
-
####Start Docker container Detached in background
74
+
### Start Docker container Detached in background
75
75
- Start the container detached with port assigned (*Assuming port 3000 for the webhook*)
76
76
-`docker run -d -p 3000:3000 safe-settings`
77
77
- You should now have the container running in the background and can validate it running with the command:
78
78
-`docker ps`
79
79
- This should show the `safe-settings` alive and running
80
80
81
-
####Start Docker container attached in forground (Debug)
81
+
### Start Docker container attached in foreground (Debug)
82
82
- If you need to run the container in interactive mode to validate connectivity and functionality:
83
83
-`docker run -it -p 3000:3000 safe-settings`
84
84
- You will now have the log of the container showing to your terminal, and can validate connectivity and functionality.
85
85
86
-
####Connect to running Docker container (Debug)
86
+
### Connect to running Docker container (Debug)
87
87
- If you need to connect to the container thats already running, you can run the following command:
88
88
-`docker exec -it safe-settings /bin/sh`
89
89
- You will now be inside the running **Docker** container and can perform any troubleshooting needed
90
90
91
-
###Deploy the app to AWS Lambda
91
+
## Deploy the app to AWS Lambda
92
92
[Serverless Framework Deployment of safe-settings on AWS](AWS-README.md)
93
+
94
+
### Proxy Support
95
+
The AWS Lambda handler, `handler.js` uses a custom `Octokit` factory that creates Octokit with ___Proxied fetch___ instead of the regular ___fetch___ when the `http_proxy`/`https_proxy` env variables are set.
96
+
97
+
In the future we can use the same pattern to support proxy in all deployments of the app.
98
+
93
99
## Deploy the app in Kubernetes
94
100
95
101
### __Deploying using kubectl__
@@ -205,24 +211,24 @@ Probot runs like [any other Node app](https://devcenter.heroku.com/articles/depl
205
211
206
212
1. Make sure you have the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) client installed.
207
213
208
-
1. Clone the app that you want to deploy. e.g. `git clone https://github.com/probot/stale`
214
+
2. Clone the app that you want to deploy. e.g. `git clone https://github.com/probot/stale`
209
215
210
-
1. Create the Heroku app with the `heroku create` command:
216
+
3. Create the Heroku app with the `heroku create` command:
211
217
212
218
$ heroku create
213
219
Creating arcane-lowlands-8408... done, stack is cedar
1. Go back to your [app settings page](https://github.com/settings/apps) and update the **Webhook URL** to the URL of your deployment, e.g. `http://arcane-lowlands-8408.herokuapp.com/`.
223
+
4. Go back to your [app settings page](https://github.com/settings/apps) and update the **Webhook URL** to the "${URL_of_your_deployment}/api/github/webhooks", e.g. `http://arcane-lowlands-8408.herokuapp.com/api/github/webhooks`.
218
224
219
-
1. Configure the Heroku app, replacing the `APP_ID` and `WEBHOOK_SECRET` with the values for those variables, and setting the path for the `PRIVATE_KEY`:
225
+
5. Configure the Heroku app, replacing the `APP_ID` and `WEBHOOK_SECRET` with the values for those variables, and setting the path for the `PRIVATE_KEY`:
@@ -231,12 +237,16 @@ Probot runs like [any other Node app](https://devcenter.heroku.com/articles/depl
231
237
-----> Launching... done
232
238
http://arcane-lowlands-8408.herokuapp.com deployed to Heroku
233
239
234
-
1. Your app should be up and running! To verify that your app
240
+
7. Your app should be up and running! To verify that your app
235
241
is receiving webhook data, you can tail your app's logs:
236
242
237
243
$ heroku config:set LOG_LEVEL=trace
238
244
$ heroku logs --tail
239
245
246
+
8. SSL [Optional]: If you want to secure webhook payloads, go to Heroku app settings => Configure SSL => Automatic Certificate Management (ACM) which uses Let's encrypt (or upload your own). Then go to the GitHub app settings, and update the url to use https:// instead
247
+
248
+
9. Cron [Optional]: You can configure this app to run on a schedule using the var (CRON), you can set it in the app settings in the UI, or using `heroku config:set CRON='0 * * * *'` to run every hour for ex.
249
+
240
250
## Create the GitHub App
241
251
242
252
Every deployment will need an [App](https://developer.github.com/apps/).
0 commit comments