-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
2,916 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# https://github.com/marketplace/actions/serverless | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
|
||
jobs: | ||
deploy: | ||
name: deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12 | ||
- run: npm ci | ||
- name: serverless deploy | ||
uses: serverless/github-action@master | ||
with: | ||
args: deploy | ||
env: | ||
# probot/example-aws-lambda-serverless secrets provided by @gr2m | ||
SERVERLESS_ACCESS_KEY: ${{ secrets.SERVERLESS_ACCESS_KEY }} | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12 | ||
- run: npx semantic-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Test | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
- run: npm ci | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# package directories | ||
node_modules | ||
|
||
# Serverless directories | ||
.serverless |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* @param {import('probot').Probot} app | ||
*/ | ||
module.exports = (app) => { | ||
app.log("Yay! The app was loaded!"); | ||
|
||
app.on("issues.opened", async (context) => { | ||
return context.octokit.issues.createComment( | ||
context.issue({ body: "Hello, World!" }) | ||
); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
default_events: | ||
- issues | ||
|
||
default_permissions: | ||
issues: write | ||
metadata: read |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"use strict"; | ||
|
||
const { createProbot } = require("probot"); | ||
const app = require("./app"); | ||
|
||
const probot = createProbot(); | ||
const loadingApp = probot.load(app); | ||
|
||
module.exports.webhooks = async (event, context) => { | ||
try { | ||
await loadingApp; | ||
|
||
// Ends function immediately after callback | ||
context.callbackWaitsForEmptyEventLoop = false; | ||
|
||
// this could will be simpler once we ship `verifyAndParse()` | ||
// see https://github.com/octokit/webhooks.js/issues/379 | ||
await probot.webhooks.verifyAndReceive({ | ||
id: | ||
event.headers["X-GitHub-Delivery"] || | ||
event.headers["x-github-delivery"], | ||
name: event.headers["X-GitHub-Event"] || event.headers["x-github-event"], | ||
signature: | ||
event.headers["X-Hub-Signature-256"] || | ||
event.headers["x-hub-signature-256"], | ||
payload: JSON.parse(event.body), | ||
}); | ||
|
||
return { | ||
statusCode: 200, | ||
body: '{"ok":true}', | ||
}; | ||
} catch (error) { | ||
console.log(error); | ||
|
||
return { | ||
statusCode: error.status || 500, | ||
error: "ooops", | ||
}; | ||
} | ||
}; |
Oops, something went wrong.