Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robandpdx/custom-deployment-rule-demo
https://github.com/robandpdx/custom-deployment-rule-demo
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/robandpdx/custom-deployment-rule-demo
- Owner: robandpdx
- License: isc
- Created: 2023-08-17T20:40:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-16T03:02:24.000Z (3 months ago)
- Last Synced: 2024-11-04T11:11:55.115Z (2 months ago)
- Language: JavaScript
- Size: 194 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Custom deployment protection rule demo
This repository is an example of a [custom deployment protection rule](https://docs.github.com/en/actions/deployment/protecting-deployments/creating-custom-deployment-protection-rules).
To use this demo app...
1. Create a GitHub App [as described here](https://docs.github.com/en/actions/deployment/protecting-deployments/creating-custom-deployment-protection-rules#creating-a-custom-deployment-protection-rule-with-github-apps).
1. Follow the instructions in the [deployment section below](#deployment).
1. Configure the deployment protection rule for your repo. [See documentation here](https://docs.github.com/en/actions/deployment/protecting-deployments/configuring-custom-deployment-protection-rules).## Local setup
Install dependencies
```
npm install
```Start the server
```
npm start
```Follow the instructions to register a new GitHub app.
## Deployment
Get the following details about your GitHub app:
- `APP_ID`
- `WEBHOOK_SECRET`
- `PRIVATE_KEY`1. Setup your aws cli creds
1. set your aws profile by running `export AWS_PROFILE=`
1. run `sam build`
1. run `sam deploy --guided`Subsequent deploys to the same stack to the default environment...
1. run `sam build`
1. run `sam deploy`## Debugging locally
There are two options to debug locally.### Debug via unit tests
1. Intall nyc and mocha: `npm install -g nyc mocha`
1. From the VSCode `RUN AND DEBUG` menu select `Mocha` and click the green arrow to start debugging.### Debug by launching probot locally and sending it a payload
1. Point your GitHub app to your local using something like smee.io
1. Copy .env-sample to .env and populate with values specific for your GitHub app. [See here for more details](https://probot.github.io/docs/configuration/).
1. From the VSCode `RUN AND DEBUG` menu select `Launch Probot` and click the green arrow to start debugging.## Docker
```sh
# 1. Run npm install
npm install# 2. Build container
docker build -t my-probot-app .# 3. Srouce your .env file
export $(cat .env | xargs)# 3. Start container
docker run \
-e APP_ID=$APP_ID \
-e PRIVATE_KEY=$PRIVATE_KEY \
-e WEBHOOK_SECRET=$WEBHOOK_SECRET \
my-probot-app
```## License
[ISC](LICENSE)