Skip to content

Commit f6d36d8

Browse files
committed
feat: add weekly cron job to build crowdin project
1 parent d82b796 commit f6d36d8

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

.github/workflows/build-crowdin.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build Crowdin project
2+
3+
on:
4+
schedule:
5+
- cron: "20 16 * * Mon"
6+
workflow_dispatch:
7+
8+
jobs:
9+
create_pr:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v3
17+
with:
18+
node-version: 18
19+
20+
- name: Install dependencies
21+
run: yarn install
22+
23+
- name: Install ts-node
24+
run: yarn global add ts-node
25+
26+
- name: Run script
27+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts
28+
env:
29+
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
30+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import crowdin from "../api-client/crowdinClient"
2+
3+
import "dotenv/config"
4+
5+
async function triggerBuild() {
6+
const projectId = Number(process.env.CROWDIN_PROJECT_ID) || 363359
7+
8+
try {
9+
await crowdin.translationsApi.buildProject(projectId)
10+
} catch (error: unknown) {
11+
console.error((error as Error).message)
12+
}
13+
}
14+
15+
triggerBuild()
16+
17+
export default triggerBuild

0 commit comments

Comments
 (0)