github-app-test
Description
This GitHub App is a test implementation for our auto-release App.
It listens to 3 GitHub webhook events (pull_request.opened
, pull_request.reopened
and release.created
).
For the two pull_request
events, it just creates a PR comment
to say Cool.
(so cool, right?!).
For the release.created
event, it:
- Create a commit with:
- an updated
package.json
, with itsversion
value changed to match with the new release. - an updated
CHANGELOG.MD
with the release description (that will mostly by automatically created) added above the other ones (but still below the title).
- an updated
- Replace the current commit (it's a merge) of the release (because it was done without those changes) and main.
- Publish the package on NPM
App Setup
App creation
- Go to your apps settings page.
- Create a new App (more infos on the creation here).
- Don't forget to fill the
Webhook secret (optional)
input with a long and random value (you can use 1Password, per example, to generate it) and fill theWEBHOOK_SECRET
env var value with it.
App post creation settings
- Copy your App ID (in the About section, at the begining) and fill the
APP_ID
env var with it. - Use smee for your webhook URL at first, and when you've setup a server (on Fly, per example), you can start using your own URL (like https://my-new-app.fly.dev/api/webhook).
- Click on the
Generate a private key
button. It will download it automatically. Fill thePRIVATE_KEY_PATH
env var with the relative path from your local repo to it. (don't forget the.pem
extension). - Go to your App permission settings (https://github.com/settings/apps/your_app_name/permissions) and click on
Repository permissions
. Then, you can set:-
Contents
toRead and write
-
Pull requests
toRead and write
-
Metadata
should be automatically setup toRead-only
-
- Install your GitHub app by following those steps
NPM Setup
- Create an account on NPM if you don't have any.
- Go to the token creation URL (
https://www.npmjs.com/settings/<your_username>/tokens
) and create aclassic
token with anAutomation
type, so it won't need the 2FA when publishing. - Fill the
NPM_TOKEN
env var with its value.