Skip to content
Permalink
Browse files
chore: add github workflow to schedule to wake up the bot on Glitch.
  • Loading branch information
plainheart committed Apr 25, 2021
1 parent 8f97cc0 commit 64376809583884f348dab8189f8db9a45f3a11ae
Showing 2 changed files with 48 additions and 0 deletions.
@@ -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
@@ -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.');
})();

2 comments on commit 6437680

@Ovilia
Copy link
Contributor

@Ovilia Ovilia commented on 6437680 Apr 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Good idea!

@plainheart
Copy link
Member Author

@plainheart plainheart commented on 6437680 Apr 25, 2021

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.

Please sign in to comment.