Skip to content
Permalink
Browse files
fix bot wake up can't get response immediately
  • Loading branch information
plainheart committed Apr 30, 2022
1 parent 0efbbd9 commit a346f143f50931ba7859e4d179b280f7ef625797
Showing 2 changed files with 14 additions and 7 deletions.
@@ -14,23 +14,25 @@ jobs:
node-version: ['12.x']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
registry-url: https://registry.npmjs.org/

- name: Cache node modules
uses: actions/cache@v2
id: cache-dep
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.cache-dep.outputs.cache-hit != 'true'
run: npm ci

- name: Wake up bot
@@ -3,9 +3,14 @@ const got = require('got');
const WAKEUP_URL = 'https://apache-incubator-echarts-bot-1.glitch.me/probot';

(async function() {
const { body } = await got(WAKEUP_URL);
const { body } = await got(WAKEUP_URL, {
headers: {
'Accept': 'text/html',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36'
}
});
if (body.indexOf('Welcome to') === -1) {
throw new Error('bot may not be working.');
}
console.log('bot is now working.');
console.log('・゚✧ bot is now working.');
})();

0 comments on commit a346f14

Please sign in to comment.