From 7f855dc8d5cf2f0f8eb03200054c7b74133e96ff Mon Sep 17 00:00:00 2001 From: Pontus Abrahamsson Date: Mon, 23 Dec 2024 14:19:36 +0100 Subject: [PATCH] Add github action init --- .github/workflows/translate.yml | 16 ++++++ apps/web/src/app/page.tsx | 10 ++-- apps/web/src/components/install.tsx | 73 ++++++++++++++++++++++------ packages/action/Dockerfile | 11 +++++ packages/action/bun.lockb | Bin 0 -> 21805 bytes packages/action/package.json | 10 ++++ packages/action/src/libs/octokit.ts | 5 ++ packages/action/src/main.ts | 3 ++ packages/action/tsconfig.json | 17 +++++++ 9 files changed, 125 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/translate.yml create mode 100644 packages/action/Dockerfile create mode 100755 packages/action/bun.lockb create mode 100644 packages/action/package.json create mode 100644 packages/action/src/libs/octokit.ts create mode 100644 packages/action/src/main.ts create mode 100644 packages/action/tsconfig.json diff --git a/.github/workflows/translate.yml b/.github/workflows/translate.yml new file mode 100644 index 0000000..44c0b74 --- /dev/null +++ b/.github/workflows/translate.yml @@ -0,0 +1,16 @@ +jobs: + translate: + name: Run translation + runs-on: ubuntu-latest + permissions: + actions: write + contents: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - name: Languine + uses: midday-ai/languine@main + env: + GH_TOKEN: ${{ github.token }} + with: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx index 4c660de..fae2c68 100644 --- a/apps/web/src/app/page.tsx +++ b/apps/web/src/app/page.tsx @@ -6,13 +6,13 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; export default function Page() { return (
- How it works - Install + Get started + Documentation About +
+ $ npx languine@latest + +
+
+ +
+

CLI

+
+          {`init          Initialize a new Languine configuration
+translate     Translate to all target locales
+translate         Translate to a specific locale
+instructions  Add custom translation instructions
+diff          Check for changes in source locale file
+clean         Clean unused translations
+available     Show available commands
+Run languine  to execute a command`}
+        
+
+ +
+

+ Github Actions{" "} + (Coming soon) +

+
+          {`jobs:
+  translate:
+    name: Run translation
+    runs-on: ubuntu-latest
+    permissions:
+      actions: write
+      contents: write
+      pull-requests: write
+    steps:
+      - uses: actions/checkout@v4
+      - name: Languine
+        uses: midday-ai/languine@main
+        env:
+          GH_TOKEN: \${{ github.token }}
+        with:
+          OPENAI_API_KEY: \${{ secrets.OPENAI_API_KEY }}
+`}
+        
); diff --git a/packages/action/Dockerfile b/packages/action/Dockerfile new file mode 100644 index 0000000..ba1a1a3 --- /dev/null +++ b/packages/action/Dockerfile @@ -0,0 +1,11 @@ +FROM oven/bun:1 + +WORKDIR /app + +COPY package*.json tsconfig.json /app/ + +COPY src /app/src + +RUN bun install + +ENTRYPOINT ["bun", "/app/src/main.ts"] \ No newline at end of file diff --git a/packages/action/bun.lockb b/packages/action/bun.lockb new file mode 100755 index 0000000000000000000000000000000000000000..110edc89e76cf4ff6907edf9478bff02bb55d991 GIT binary patch literal 21805 zcmeHv30RC<{Qp#A$+eWF644?g(_WHLTCS216|JV4YM5p+Glgs;WXV#b#nM8AEZs{k z;pU2N${vwyDN7gG#f|*G-K)e9*dq5lxF{XVW#`3^WCTBL>le8<`cZd9O5F?Kz#K=FG zF3FzKgPLS9-gg~RqUM{Hp{b!=sdHLU`?#0fwhG6(wD2z+xtwrq``gnFrClAa z^x*09ATRg3)~D^c1zs+7dk4>#kLq@GjkZ$6oZWY6kwf~1UanedVFZH91&e`izZo zhAy*S)ePY6P&Cb-l--%HJa)V4@4mT(LoW?c_FQ&MY2KXQb~_Ao$oSp%;(h(|8kaQc zLsd#Ad!(gUywAKb^rW(VwnzVpk)uA?te<)0(T&b}`liPcM%>s{a&1`9P&+Ffr&Yi5 z-W#QtJxiOwSvB)%=XJkTZW=Vv_( zMgksjC_Bk-xn)TSspkcXL;EHABl&H`?*pJS;K7Wj6V7n+oTLZy6 zN%7cs#FPBC@L-#G;o1e$P&{@xjuj zaACk0@vtYPp-sWsCJq>5zOy7Lju8*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rnjE;tFjU<|Y7OZjxq5jsV&!T@(8Tt|n>m(3-cCib66H)+o~^eI-`imTr=|KuB)! z@haUmwS_@ybU+}zYut6U1ukA8#AXZ(jS2D6`@NM)X86)cCtDC2Won@W=uP11*~W?Z zEeWn2AZ>Hm3^-In>uVo#;~LjU+nC1~36x@U4#1U=#bpJ~Zbh|?m4K`<0gqPWk?<=^(ovU@Q_Q>zt^y{v+4XersaSV>+q838OI)4;fCr3fz8 zg{6!g2oHrIS)r5@%6NQs6ceAIj0k??13^+QeFE4>Rubl10fWN~3kYJiqUitBg&sBn zaT>rxGHbIfG?7E5EU8@L`OsdSf7@jlDJrUoGQ{K2=IJILlW)|GeFs)}g=#ViZF(`0 z4V9Qdq6Zvo!r7S9xGXe>31UUE16i$&m~8)oqDp8bpr%bp@_s-m5=z+cH06VgcCLyN z27tjKr*tuH+GFabYA!1PAM0(}zL2^gAi2forSwfg)&_ap$?Aybg{)YX-HwgZw-~Af zR4f19>w`>)=4Axh<_lm1P?v37|HP(98Au#LT=&F_mXOB`Vgxb+Ls^ZRpb&U9hzP*V zE@Rf*wr!`HLO}4A*kJ9JzMi*Y+>Js3Q)2=)QurPL-Ig5ANDgFL { + console.log("Hello, world!"); +})(); diff --git a/packages/action/tsconfig.json b/packages/action/tsconfig.json new file mode 100644 index 0000000..f21f3f2 --- /dev/null +++ b/packages/action/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "strict": true, + "pretty": true, + "esModuleInterop": true, + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true, + "skipLibCheck": true, + "skipDefaultLibCheck": true, + "moduleResolution": "NodeNext", + "module": "NodeNext", + "target": "ESNext", + "rootDir": "src", + "outDir": "build" + }, + "include": ["src/**/*.ts"] +}