-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (57 loc) · 1.81 KB
/
answer.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
57
58
59
60
61
62
63
64
65
name: Daily Answer Script
on:
schedule:
- cron: "30 22 * * *"
workflow_dispatch:
inputs:
account:
description: "账号"
required: false
password:
description: "密码"
required: false
date:
description: "日期"
required: false
env:
ACCOUNT: ${{ github.event.inputs.account || secrets.ACCOUNT }}
PASSWORD: ${{ github.event.inputs.password || secrets.PASSWORD }}
KEY: ${{ secrets.KEY }}
IV: ${{ secrets.IV }}
DATE: ${{ github.event.inputs.date }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Bun environment
id: cache-bun
uses: actions/cache@v3
with:
path: ~/.bun
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Setup Bun
if: steps.cache-bun.outputs.cache-hit != 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/bun.lockb') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install dependencies if needed
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: bun install
- name: Run Answer Script and Send Telegram Message
run: |
bun run index.ts || true
output=$(cat output.txt)
curl -s -X POST https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage -d chat_id=${TELEGRAM_CHAT_ID} -d text="$output"