Permalink
Show file tree
Hide file tree
2 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
chore: add github workflow to schedule to wake up the bot on Glitch.
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 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
@@ -0,0 +1,37 @@ | ||
name: Wake up Bot on Glitch | ||
|
||
on: | ||
schedule: | ||
- cron: '*/5 * * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
wakeup: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: ['12.x'] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Intsall dependencies | ||
run: npm ci | ||
|
||
- name: Wake up bot | ||
run: node src/glitch/wakeup.js |
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
@@ -0,0 +1,11 @@ | ||
const got = require('got'); | ||
|
||
const WAKEUP_URL = 'https://apache-incubator-echarts-bot-1.glitch.me/probot'; | ||
|
||
(async function() { | ||
const { body } = await got(WAKEUP_URL); | ||
if (body.indexOf('Welcome to') === -1) { | ||
throw new Error('bot may not be working.'); | ||
} | ||
console.log('bot is now working.'); | ||
})(); |
6437680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! Good idea!
6437680
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! Inspired by @pissang, before using workflow, we're running the service in our own server or any other way. It is not so convenient.