-
Notifications
You must be signed in to change notification settings - Fork 3
56 lines (54 loc) · 1.62 KB
/
bot.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: cov19medbot
on:
# schedule:
# # every 10 minutes the job will run
# - cron: "*/10 * * * *"
push:
branches:
- main
repository_dispatch:
types: [my-event]
jobs:
run-bot:
runs-on: ubuntu-latest
# timeout-minutes: 9
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Python dependencies
run: pip install -r requirements.txt
- name: Start Bot
run: |
python main.py
env:
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
SHEETS_TOKEN: ${{ secrets.SHEETS_TOKEN }}
UPDATE_ID: ${{ github.event.client_payload.update_id }}
- name: Repository Dispatch
uses: actions/github-script@v2
with:
github-token: ${{secrets.JUN_TOKEN}}
script: |
const fs = require('fs');
update_id = fs.readFileSync('/tmp/update_id', 'utf8');
await github.repos.createDispatchEvent({
owner: context.repo.owner,
repo: context.repo.repo,
event_type: "my-event",
client_payload: { greeting: "lalala", update_id: update_id }
});