-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (61 loc) · 2.33 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
57
58
59
60
61
62
63
64
65
66
name: Bot
on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: "0 * * * *"
jobs:
run:
runs-on: ubuntu-latest
strategy:
matrix:
bun: ["1.1.22"]
steps:
- uses: actions/checkout@v2
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.bun }}
- run: bun install
- name: Restore cookies
id: restore-cookies
uses: icyleaf/[email protected]
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_KV_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT }}
with:
namespace_id: ${{ secrets.CLOUDFLARE_KV_NAMESPACE }}
key: cookies
- name: Run script
id: action
timeout-minutes: 2
run: |
(echo "${{ steps.restore-cookies.outputs.value }}" \
| openssl enc -d -des3 -base64 -pass pass:${{ secrets.ENCRYPTION_KEY }} -pbkdf2 || echo '{}') \
> cookies.json
export COOKIES=$(cat cookies.json)
echo "::add-mask::$COOKIES"
echo "::set-output name=original-cookies::$COOKIES"
bun src/index.ts \
--vrchat-email="${{ secrets.VRCHAT_EMAIL }}" \
--vrchat-password="${{ secrets.VRCHAT_PASSWORD }}" \
--vrchat-totp-secret="${{ secrets.VRCHAT_TOTP_SECRET }}" \
--mediawiki-username="${{ secrets.MEDIAWIKI_USERNAME }}" \
--mediawiki-password="${{ secrets.MEDIAWIKI_PASSWORD }}" \
export COOKIES=$(cat cookies.json)
echo "::add-mask::$COOKIES"
echo "::set-output name=updated-cookies::$COOKIES"
export ENCRYPTED_COOKIES=$(echo $COOKIES | openssl enc -e -des3 -base64 -pass pass:${{ secrets.ENCRYPTION_KEY }} -pbkdf2 -A)
echo "::set-output name=encrypted-cookies::$ENCRYPTED_COOKIES"
- name: Save cookies
if: steps.action.outputs.updated-cookies != steps.action.outputs.original-cookies
uses: icyleaf/[email protected]
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_KV_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT }}
with:
namespace_id: ${{ secrets.CLOUDFLARE_KV_NAMESPACE }}
key: cookies
value: ${{ steps.action.outputs.encrypted-cookies }}
overwrite: true