This is an automated email from the ASF dual-hosted git repository. wangzx pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/echarts-bot.git
The following commit(s) were added to refs/heads/master by this push: new a346f14 fix bot wake up can't get response immediately a346f14 is described below commit a346f143f50931ba7859e4d179b280f7ef625797 Author: plainheart <y...@all-my-life.cn> AuthorDate: Sat Apr 30 20:33:58 2022 +0800 fix bot wake up can't get response immediately --- .github/workflows/bot-wakup.yml | 12 +++++++----- src/glitch/wakeup.js | 9 +++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bot-wakup.yml b/.github/workflows/bot-wakup.yml index 3efed22..cad125a 100644 --- a/.github/workflows/bot-wakup.yml +++ b/.github/workflows/bot-wakup.yml @@ -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 diff --git a/src/glitch/wakeup.js b/src/glitch/wakeup.js index 2c361e7..2e09bd4 100644 --- a/src/glitch/wakeup.js +++ b/src/glitch/wakeup.js @@ -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.'); })(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org