Repository navigation
75 lines (63 loc) · 2.27 KB
/
Copy patherror-code-sync.yml
File metadata and controls
75 lines (63 loc) · 2.27 KB
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
67
68
69
70
71
72
73
74
75
name: Error Code Sync
on:
schedule:
- cron: '0 1 * * 1' # 월요일 10:00 KST
workflow_dispatch:
permissions: {}
concurrency:
group: error-code-sync
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: dev
fetch-depth: 0
token: ${{ secrets.ERROR_CODE_SYNC_TOKEN }}
- name: Setup pnpm
uses: pnpm/action-setup@v6
- name: Setup Node.js
uses: actions/setup-node@v7
with:
node-version: 22
- name: Get pnpm store directory
id: pnpm-cache
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache pnpm store
uses: actions/cache@v6
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Unit test
run: node --test .github/scripts/error-code-sync/lib.test.mjs
- name: 서버 에러 코드 대조
env:
GH_TOKEN: ${{ secrets.ERROR_CODE_SYNC_TOKEN }}
run: node .github/scripts/error-code-sync/index.mjs
notify-failure:
needs: sync
if: ${{ always() && (needs.sync.result == 'failure' || needs.sync.result == 'cancelled') }}
runs-on: ubuntu-latest
timeout-minutes: 2
permissions: {}
steps:
- name: 실패 알림 (허거덩 봇)
env:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.DISCORD_PR_CHANNEL_ID }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
curl -sS --fail-with-body --max-time 10 -o /dev/null \
-X POST "https://discord.com/api/v10/channels/$CHANNEL_ID/messages" \
-H "Authorization: Bot $DISCORD_BOT_TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
--data "$(jq -n --arg url "$RUN_URL" '{content: "⚠️ 서버 에러 코드 카탈로그 동기화 실패 · <\($url)>", allowed_mentions: {parse: []}}')"