Skip to content

Commit

Permalink
handle action body json parse error
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Aug 26, 2020
1 parent a048ba8 commit d87686a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Git tag
run: echo "::set-env name=HEAD_TAG::$(git tag --points-at HEAD)"
- name: Webhook
uses: joelwmale/webhook-action@master
uses: joelwmale/webhook-action@749e2dcbc6735ce0c36e1dbbb660618cd7b5f91c
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
data: "{'text': '[GITHUB] New release in sphinx-relay! ${{ env.HEAD_TAG }}', 'action': 'broadcast', 'app': 'github', 'secret': '${{ secrets.WEBHOOK_SECRET }}', 'chat_uuid': 'XzsnzB-numfWNUcTXGkEkoMKCt4k36C2t60a-zohJTWrL--vHjia2WQ11gwbwdAtnsYTT3fyzRhH2YF7KqiOxwnGVlkd'}"
10 changes: 8 additions & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ jobs:
runs-on:
- ubuntu-latest
steps:
- name: Check out from Git
uses: actions/checkout@v2
- name: Git tag
run: echo "::set-env name=COMMIT_MSG::$(git log -1 --pretty=format:%B)"
- name: Commit Author
run: echo "::set-env name=COMMIT_AUTHOR::$(git log -1 --pretty=format:'%an')"
- name: Webhook
uses: joelwmale/webhook-action@master
uses: joelwmale/webhook-action@749e2dcbc6735ce0c36e1dbbb660618cd7b5f91c
env:
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
data: "{'text': '[GITHUB] New push in sphinx-relay master', 'action': 'broadcast', 'app': 'github', 'secret': '${{ secrets.WEBHOOK_SECRET }}', 'chat_uuid': 'XzsnzB-numfWNUcTXGkEkoMKCt4k36C2t60a-zohJTWrL--vHjia2WQ11gwbwdAtnsYTT3fyzRhH2YF7KqiOxwnGVlkd'}"
data: "{'text': 'New push in sphinx-relay by ${{ env.COMMIT_AUTHOR }}: ${{ env.COMMIT_MSG }}', 'action': 'broadcast', 'app': 'github', 'secret': '${{ secrets.WEBHOOK_SECRET }}', 'chat_uuid': 'XzsnzB-numfWNUcTXGkEkoMKCt4k36C2t60a-zohJTWrL--vHjia2WQ11gwbwdAtnsYTT3fyzRhH2YF7KqiOxwnGVlkd'}"
1 change: 1 addition & 0 deletions api/controllers/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async function processExtra(req, res) {
if(dataBody) body=dataBody
} catch(e) {
console.log(e)
return failure(res, 'failed to parse webhook body json')
}
}
const {action,app,secret,pubkey,amount,chat_uuid,text} = body
Expand Down
1 change: 1 addition & 0 deletions dist/api/controllers/actions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/api/controllers/actions.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d87686a

Please sign in to comment.