Skip to content

Commit 0b16944

Browse files
committed
Initial Version
1 parent 1414ac3 commit 0b16944

20 files changed

Lines changed: 6246 additions & 1 deletion

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# https://editorconfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
end_of_line = lf
8+
9+
indent_style = space
10+
indent_size = 2
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[*.md]
15+
trim_trailing_whitespace = false
16+
17+
[*.{diff,patch}]
18+
trim_trailing_whitespace = false

.env.defaults

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SECRET=
2+
SCRIPT=
3+
PORT=number=32490
4+
VERBOSE=boolean=false

.eslintrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"extends": "@jessety",
3+
"overrides": [
4+
{
5+
"files": ["**/*.test.{js,cjs}"],
6+
"parserOptions": { "sourceType": "script" },
7+
"env": { "jest": true },
8+
"rules": { "no-console": "warn" }
9+
}
10+
]
11+
}

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: ci
2+
3+
on: [push]
4+
5+
jobs:
6+
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Setup Node
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 14.x
15+
- run: npm install
16+
- run: npm run lint
17+
env:
18+
CI: true
19+
20+
test:
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
os: [ubuntu-latest, windows-latest, macos-latest]
26+
node: [14.x, 12.x]
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Use Node ${{ matrix.node }}
30+
uses: actions/setup-node@v1
31+
with:
32+
node-version: ${{ matrix.node }}
33+
- run: npm install
34+
- run: npm run test
35+
env:
36+
CI: true

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Push events for tags matching v*, e.g. v1.0, v20.15.10
7+
8+
jobs:
9+
build:
10+
name: release
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
with:
17+
fetch-depth: 0 # git history won't be fetched without this option
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v1
21+
22+
- name: Install Dependencies
23+
run: npm install
24+
25+
- name: Generate Release Notes
26+
run: npx auto-changelog --template RELEASE.md.hbs --output RELEASE.md --commit-limit false
27+
28+
- name: Parse Release Notes
29+
id: parse
30+
run: |
31+
NOTES=$(cat RELEASE.md)
32+
NOTES="${NOTES//'%'/'%25'}"
33+
NOTES="${NOTES//$'\n'/'%0A'}"
34+
echo "::set-output name=notes::$NOTES"
35+
36+
- name: Create Release
37+
id: create_release
38+
uses: actions/create-release@v1
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions
41+
with:
42+
tag_name: ${{ github.ref }}
43+
release_name: ${{ github.ref }}
44+
body: ${{ steps.parse.outputs.notes }}
45+
draft: false
46+
prerelease: false

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
node_modules
2+
coverage
3+
.env
4+
5+
RELEASE.md
6+
7+
**/*.swp
8+
**/.DS_Store
9+
**/.Spotlight-V100
10+
**/[Tt]humbs.db
11+
**/[Dd]esktop.ini

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"editorconfig.editorconfig",
4+
"dbaeumer.vscode-eslint",
5+
"mikestead.dotenv"
6+
],
7+
"unwantedRecommendations": []
8+
}

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"search.exclude": {
3+
"coverage:": true,
4+
"node_modules": true
5+
},
6+
"files.associations": {
7+
".env.defaults": "dotenv"
8+
}
9+
}

README.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
# github-webhook
1+
# github-webhook
2+
3+
A minimal GitHub webhook listener that executes a specified command when a release is published.
4+
5+
## Installation
6+
7+
```bash
8+
git clone ...
9+
cd github-webhook
10+
npm install --production
11+
pm2 start ecosystem.config.json
12+
```
13+
14+
## Configuration
15+
16+
Edit an `.env` file in the project directory with the following options:
17+
18+
```ini
19+
# GitHub Webhook Secret
20+
SECRET=ABC123
21+
22+
# Script to execute when a release is published
23+
SCRIPT=/usr/bin/local/update.sh
24+
25+
# Port to run the server on
26+
PORT=32490
27+
```
28+
29+
## License
30+
31+
MIT © Jesse Youngblood

RELEASE.md.hbs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{{#each releases}}
2+
{{#if @first}}
3+
{{#if summary}}
4+
{{summary}}
5+
{{/if}}
6+
{{#each merges}}
7+
- {{message}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}
8+
{{/each}}
9+
{{#each fixes}}
10+
- {{commit.subject}}{{#each fixes}}{{#if href}} [`#{{id}}`]({{href}}){{/if}}{{/each}}
11+
{{/each}}
12+
{{#each commits}}
13+
- {{subject}}{{#if href}} [`{{shorthash}}`]({{href}}){{/if}}
14+
{{/each}}
15+
{{/if}}
16+
{{/each}}

0 commit comments

Comments
 (0)