From 038799e692bf889a5980baad15835062f9964092 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 19:14:22 +0900 Subject: [PATCH 01/13] feat: add git workflow --- .github/workflows/sync-pr-to-notion.yml | 36 ++ .gitignore | 2 + README.md | 11 + assets/id.png | Bin 0 -> 2904 bytes package.json | 19 + pnpm-lock.yaml | 544 ++++++++++++++++++++++++ scripts/sync-notion.ts | 64 +++ tsconfig.json | 13 + 8 files changed, 689 insertions(+) create mode 100644 .github/workflows/sync-pr-to-notion.yml create mode 100644 .gitignore create mode 100644 assets/id.png create mode 100644 package.json create mode 100644 pnpm-lock.yaml create mode 100644 scripts/sync-notion.ts create mode 100644 tsconfig.json diff --git a/.github/workflows/sync-pr-to-notion.yml b/.github/workflows/sync-pr-to-notion.yml new file mode 100644 index 0000000..89023bb --- /dev/null +++ b/.github/workflows/sync-pr-to-notion.yml @@ -0,0 +1,36 @@ +name: Sync PR to Notion + +on: + # 다른 레포에서 호출하는 로직 + # workflow_call: + # secrets: + # NOTION_TOKEN: + # required: true + # NOTION_DATABASE_ID: + # required: true + # NOTION_PROP_ID: + # required: true + # NOTION_PROP_STATUS: + # required: true + # NOTION_PROP_PR: + # required: true + pull_request: + types: [opened, reopened, synchronize, closed] + +jobs: + sync-notion: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - run: npm ci + + - run: npx tsx scripts/sync-notion.ts + env: + NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} + NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5109010 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Node.js +node_modules/ \ No newline at end of file diff --git a/README.md b/README.md index da2c5a1..ad2ffcb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ # org-actions-template 노션 - 깃허브 연동을 위한 자동화 레포지토리 + +## 설정 +notion 설정 +- 식별할 수 있는 기본키 이름이 ID여야 합니다. + ![기본키](assets/id.png) + +github secret 설정 +- 노션 데이터베이스 아이디를 레포지토리 시크릿 키로 저장해야 합니다. 데이터베이스 아이디는 노션 링크의 숫자 부분입니다. +``` +https://www.notion.so/example/example-227402b843138042a10ec85b1ec04aaf 에서 227402b843138042a10ec85b1ec04aaf 부분 +``` \ No newline at end of file diff --git a/assets/id.png b/assets/id.png new file mode 100644 index 0000000000000000000000000000000000000000..94ff79bd054f313e1a095854c3d173ba1f5f05e4 GIT binary patch literal 2904 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 literal 0 HcmV?d00001 diff --git a/package.json b/package.json new file mode 100644 index 0000000..157c3a8 --- /dev/null +++ b/package.json @@ -0,0 +1,19 @@ +{ + "name": "org-actions-template", + "version": "1.0.0", + "type": "module", + "main": "index.js", + "license": "MIT", + "scripts": { + "start": "tsx scripts/sync-notion.ts" + }, + "dependencies": { + "@actions/core": "^1.10.0", + "@actions/github": "^5.0.0", + "@notionhq/client": "^4.0.1", + "tsx": "^3.12.7" + }, + "devDependencies": { + "typescript": "^5.0.4" + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..4876440 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,544 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + dependencies: + '@actions/core': + specifier: ^1.10.0 + version: 1.11.1 + '@actions/github': + specifier: ^5.0.0 + version: 5.1.1 + '@notionhq/client': + specifier: ^4.0.1 + version: 4.0.1 + tsx: + specifier: ^3.12.7 + version: 3.14.0 + devDependencies: + typescript: + specifier: ^5.0.4 + version: 5.9.2 + +packages: + + '@actions/core@1.11.1': + resolution: {integrity: sha512-hXJCSrkwfA46Vd9Z3q4cpEpHB1rL5NG04+/rbqW9d3+CSvtB1tYe8UTpAlixa1vj0m/ULglfEK2UKxMGxCxv5A==} + + '@actions/exec@1.1.1': + resolution: {integrity: sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==} + + '@actions/github@5.1.1': + resolution: {integrity: sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g==} + + '@actions/http-client@2.2.3': + resolution: {integrity: sha512-mx8hyJi/hjFvbPokCg4uRd4ZX78t+YyRPtnKWwIl+RzNaVuFpQHfmlGVfsKEJN8LwTCvL+DfVgAM04XaHkm6bA==} + + '@actions/io@1.1.3': + resolution: {integrity: sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==} + + '@esbuild/android-arm64@0.18.20': + resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + + '@esbuild/android-arm@0.18.20': + resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + + '@esbuild/android-x64@0.18.20': + resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + + '@esbuild/darwin-arm64@0.18.20': + resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + + '@esbuild/darwin-x64@0.18.20': + resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + + '@esbuild/freebsd-arm64@0.18.20': + resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + + '@esbuild/freebsd-x64@0.18.20': + resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + + '@esbuild/linux-arm64@0.18.20': + resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + + '@esbuild/linux-arm@0.18.20': + resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + + '@esbuild/linux-ia32@0.18.20': + resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + + '@esbuild/linux-loong64@0.18.20': + resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + + '@esbuild/linux-mips64el@0.18.20': + resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + + '@esbuild/linux-ppc64@0.18.20': + resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + + '@esbuild/linux-riscv64@0.18.20': + resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + + '@esbuild/linux-s390x@0.18.20': + resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + + '@esbuild/linux-x64@0.18.20': + resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + + '@esbuild/netbsd-x64@0.18.20': + resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + + '@esbuild/openbsd-x64@0.18.20': + resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + + '@esbuild/sunos-x64@0.18.20': + resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + + '@esbuild/win32-arm64@0.18.20': + resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + + '@esbuild/win32-ia32@0.18.20': + resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + + '@esbuild/win32-x64@0.18.20': + resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + + '@fastify/busboy@2.1.1': + resolution: {integrity: sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==} + engines: {node: '>=14'} + + '@notionhq/client@4.0.1': + resolution: {integrity: sha512-SdILqiiThECLR2KDUOvl4JqRaJWBwDYaEw/f0qu+G6rKN/QUCkaJ84vN5MgBw1yKsMAsKxBlDazs3Jw6vv2ikA==} + engines: {node: '>=18'} + + '@octokit/auth-token@2.5.0': + resolution: {integrity: sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==} + + '@octokit/core@3.6.0': + resolution: {integrity: sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==} + + '@octokit/endpoint@6.0.12': + resolution: {integrity: sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==} + + '@octokit/graphql@4.8.0': + resolution: {integrity: sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==} + + '@octokit/openapi-types@12.11.0': + resolution: {integrity: sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==} + + '@octokit/plugin-paginate-rest@2.21.3': + resolution: {integrity: sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==} + peerDependencies: + '@octokit/core': '>=2' + + '@octokit/plugin-rest-endpoint-methods@5.16.2': + resolution: {integrity: sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==} + peerDependencies: + '@octokit/core': '>=3' + + '@octokit/request-error@2.1.0': + resolution: {integrity: sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==} + + '@octokit/request@5.6.3': + resolution: {integrity: sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==} + + '@octokit/types@6.41.0': + resolution: {integrity: sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==} + + before-after-hook@2.2.3: + resolution: {integrity: sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + deprecation@2.3.1: + resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} + + esbuild@0.18.20: + resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} + engines: {node: '>=12'} + hasBin: true + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + get-tsconfig@4.10.1: + resolution: {integrity: sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ==} + + is-plain-object@5.0.0: + resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==} + engines: {node: '>=0.10.0'} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + tsx@3.14.0: + resolution: {integrity: sha512-xHtFaKtHxM9LOklMmJdI3BEnQq/D5F73Of2E1GDrITi9sgoVkvIsrQUTY1G8FlmGtA+awCI4EBlTRRYxkL2sRg==} + hasBin: true + + tunnel@0.0.6: + resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} + engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} + + typescript@5.9.2: + resolution: {integrity: sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==} + engines: {node: '>=14.17'} + hasBin: true + + undici@5.29.0: + resolution: {integrity: sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==} + engines: {node: '>=14.0'} + + universal-user-agent@6.0.1: + resolution: {integrity: sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==} + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + +snapshots: + + '@actions/core@1.11.1': + dependencies: + '@actions/exec': 1.1.1 + '@actions/http-client': 2.2.3 + + '@actions/exec@1.1.1': + dependencies: + '@actions/io': 1.1.3 + + '@actions/github@5.1.1': + dependencies: + '@actions/http-client': 2.2.3 + '@octokit/core': 3.6.0 + '@octokit/plugin-paginate-rest': 2.21.3(@octokit/core@3.6.0) + '@octokit/plugin-rest-endpoint-methods': 5.16.2(@octokit/core@3.6.0) + transitivePeerDependencies: + - encoding + + '@actions/http-client@2.2.3': + dependencies: + tunnel: 0.0.6 + undici: 5.29.0 + + '@actions/io@1.1.3': {} + + '@esbuild/android-arm64@0.18.20': + optional: true + + '@esbuild/android-arm@0.18.20': + optional: true + + '@esbuild/android-x64@0.18.20': + optional: true + + '@esbuild/darwin-arm64@0.18.20': + optional: true + + '@esbuild/darwin-x64@0.18.20': + optional: true + + '@esbuild/freebsd-arm64@0.18.20': + optional: true + + '@esbuild/freebsd-x64@0.18.20': + optional: true + + '@esbuild/linux-arm64@0.18.20': + optional: true + + '@esbuild/linux-arm@0.18.20': + optional: true + + '@esbuild/linux-ia32@0.18.20': + optional: true + + '@esbuild/linux-loong64@0.18.20': + optional: true + + '@esbuild/linux-mips64el@0.18.20': + optional: true + + '@esbuild/linux-ppc64@0.18.20': + optional: true + + '@esbuild/linux-riscv64@0.18.20': + optional: true + + '@esbuild/linux-s390x@0.18.20': + optional: true + + '@esbuild/linux-x64@0.18.20': + optional: true + + '@esbuild/netbsd-x64@0.18.20': + optional: true + + '@esbuild/openbsd-x64@0.18.20': + optional: true + + '@esbuild/sunos-x64@0.18.20': + optional: true + + '@esbuild/win32-arm64@0.18.20': + optional: true + + '@esbuild/win32-ia32@0.18.20': + optional: true + + '@esbuild/win32-x64@0.18.20': + optional: true + + '@fastify/busboy@2.1.1': {} + + '@notionhq/client@4.0.1': {} + + '@octokit/auth-token@2.5.0': + dependencies: + '@octokit/types': 6.41.0 + + '@octokit/core@3.6.0': + dependencies: + '@octokit/auth-token': 2.5.0 + '@octokit/graphql': 4.8.0 + '@octokit/request': 5.6.3 + '@octokit/request-error': 2.1.0 + '@octokit/types': 6.41.0 + before-after-hook: 2.2.3 + universal-user-agent: 6.0.1 + transitivePeerDependencies: + - encoding + + '@octokit/endpoint@6.0.12': + dependencies: + '@octokit/types': 6.41.0 + is-plain-object: 5.0.0 + universal-user-agent: 6.0.1 + + '@octokit/graphql@4.8.0': + dependencies: + '@octokit/request': 5.6.3 + '@octokit/types': 6.41.0 + universal-user-agent: 6.0.1 + transitivePeerDependencies: + - encoding + + '@octokit/openapi-types@12.11.0': {} + + '@octokit/plugin-paginate-rest@2.21.3(@octokit/core@3.6.0)': + dependencies: + '@octokit/core': 3.6.0 + '@octokit/types': 6.41.0 + + '@octokit/plugin-rest-endpoint-methods@5.16.2(@octokit/core@3.6.0)': + dependencies: + '@octokit/core': 3.6.0 + '@octokit/types': 6.41.0 + deprecation: 2.3.1 + + '@octokit/request-error@2.1.0': + dependencies: + '@octokit/types': 6.41.0 + deprecation: 2.3.1 + once: 1.4.0 + + '@octokit/request@5.6.3': + dependencies: + '@octokit/endpoint': 6.0.12 + '@octokit/request-error': 2.1.0 + '@octokit/types': 6.41.0 + is-plain-object: 5.0.0 + node-fetch: 2.7.0 + universal-user-agent: 6.0.1 + transitivePeerDependencies: + - encoding + + '@octokit/types@6.41.0': + dependencies: + '@octokit/openapi-types': 12.11.0 + + before-after-hook@2.2.3: {} + + buffer-from@1.1.2: {} + + deprecation@2.3.1: {} + + esbuild@0.18.20: + optionalDependencies: + '@esbuild/android-arm': 0.18.20 + '@esbuild/android-arm64': 0.18.20 + '@esbuild/android-x64': 0.18.20 + '@esbuild/darwin-arm64': 0.18.20 + '@esbuild/darwin-x64': 0.18.20 + '@esbuild/freebsd-arm64': 0.18.20 + '@esbuild/freebsd-x64': 0.18.20 + '@esbuild/linux-arm': 0.18.20 + '@esbuild/linux-arm64': 0.18.20 + '@esbuild/linux-ia32': 0.18.20 + '@esbuild/linux-loong64': 0.18.20 + '@esbuild/linux-mips64el': 0.18.20 + '@esbuild/linux-ppc64': 0.18.20 + '@esbuild/linux-riscv64': 0.18.20 + '@esbuild/linux-s390x': 0.18.20 + '@esbuild/linux-x64': 0.18.20 + '@esbuild/netbsd-x64': 0.18.20 + '@esbuild/openbsd-x64': 0.18.20 + '@esbuild/sunos-x64': 0.18.20 + '@esbuild/win32-arm64': 0.18.20 + '@esbuild/win32-ia32': 0.18.20 + '@esbuild/win32-x64': 0.18.20 + + fsevents@2.3.3: + optional: true + + get-tsconfig@4.10.1: + dependencies: + resolve-pkg-maps: 1.0.0 + + is-plain-object@5.0.0: {} + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + resolve-pkg-maps@1.0.0: {} + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + tr46@0.0.3: {} + + tsx@3.14.0: + dependencies: + esbuild: 0.18.20 + get-tsconfig: 4.10.1 + source-map-support: 0.5.21 + optionalDependencies: + fsevents: 2.3.3 + + tunnel@0.0.6: {} + + typescript@5.9.2: {} + + undici@5.29.0: + dependencies: + '@fastify/busboy': 2.1.1 + + universal-user-agent@6.0.1: {} + + webidl-conversions@3.0.1: {} + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + wrappy@1.0.2: {} diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts new file mode 100644 index 0000000..31cd4a5 --- /dev/null +++ b/scripts/sync-notion.ts @@ -0,0 +1,64 @@ +// scripts/sync-notion.ts +import { Client } from "@notionhq/client"; +import * as core from "@actions/core"; +import * as github from "@actions/github"; + +const notion = new Client({ auth: process.env.NOTION_TOKEN }); + +async function run() { + try { + const dbId = process.env.NOTION_DATABASE_ID!; + const propId = process.env.NOTION_PROP_ID || "ID"; + const propStatus = process.env.NOTION_PROP_STATUS || "상태"; + const propPR = process.env.NOTION_PROP_PR || "GitHub Pull Requests"; + + const { pull_request: pr } = github.context.payload as any; + if (!pr) throw new Error("No pull request context available"); + + const branch = pr.head.ref; + const prUrl = pr.html_url; + const prState = pr.merged ? "완료" : pr.state === "open" ? "진행 중" : ""; + + const match = branch.match(/([A-Z]+-\d+)/); + if (!match) throw new Error("No matching document ID in branch name"); + const documentId = match[1]; + + // 🔍 Find the Notion page with the matching ID + const searchResult = await notion.databases.query({ + database_id: dbId, + filter: { + property: propId, + rich_text: { + equals: documentId, + }, + }, + }); + + if (searchResult.results.length === 0) { + throw new Error(`No Notion page found with ID: ${documentId}`); + } + + const pageId = searchResult.results[0].id; + + // 📝 Update the page + const update: any = { + properties: { + [propPR]: { + url: prUrl, + }, + }, + }; + if (prState) { + update.properties[propStatus] = { + select: { name: prState }, + }; + } + + await notion.pages.update({ page_id: pageId, ...update }); + console.log(`✅ Notion page ${documentId} updated.`); + } catch (err) { + core.setFailed((err as Error).message); + } +} + +run(); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..b9940b2 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "nodenext", + "moduleResolution": "nodenext", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "outDir": "dist" + }, + "include": ["scripts"] +} From 8601fec9b1b76fe1dbb5b4ffc71ebfaf7d0bd59c Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 19:19:14 +0900 Subject: [PATCH 02/13] refactor: reduce env variable --- README.md | 1 + scripts/sync-notion.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ad2ffcb..8f54314 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ notion 설정 github secret 설정 - 노션 데이터베이스 아이디를 레포지토리 시크릿 키로 저장해야 합니다. 데이터베이스 아이디는 노션 링크의 숫자 부분입니다. +- 시크릿 키 이름은 `NOTION_DATABASE_ID`로 설정해야 합니다. ``` https://www.notion.so/example/example-227402b843138042a10ec85b1ec04aaf 에서 227402b843138042a10ec85b1ec04aaf 부분 ``` \ No newline at end of file diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 31cd4a5..373c3ff 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -8,9 +8,9 @@ const notion = new Client({ auth: process.env.NOTION_TOKEN }); async function run() { try { const dbId = process.env.NOTION_DATABASE_ID!; - const propId = process.env.NOTION_PROP_ID || "ID"; - const propStatus = process.env.NOTION_PROP_STATUS || "상태"; - const propPR = process.env.NOTION_PROP_PR || "GitHub Pull Requests"; + const propId = "ID"; + const propStatus = "상태"; + const propPR = "GitHub Pull Requests"; const { pull_request: pr } = github.context.payload as any; if (!pr) throw new Error("No pull request context available"); From 08efeca18d49bdf5233b0c1874071636db19a317 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 19:26:56 +0900 Subject: [PATCH 03/13] refactor: update yml --- .github/workflows/sync-pr-to-notion.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-pr-to-notion.yml b/.github/workflows/sync-pr-to-notion.yml index 89023bb..5085b26 100644 --- a/.github/workflows/sync-pr-to-notion.yml +++ b/.github/workflows/sync-pr-to-notion.yml @@ -26,11 +26,15 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 22 + cache: 'pnpm' - - run: npm ci + - uses: pnpm/action-setup@v2 + with: + version: 10.13.1 + run_install: true - - run: npx tsx scripts/sync-notion.ts + - run: pnpm exec tsx scripts/sync-notion.ts env: NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }} NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} From d9df3c741e1be6cca467e610242b215df0ccd8bc Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 19:29:35 +0900 Subject: [PATCH 04/13] =?UTF-8?q?refactor:=20=EC=A0=95=ED=99=95=ED=95=9C?= =?UTF-8?q?=20=EB=B2=84=EC=A0=84=EB=AA=85=20=EA=B8=B0=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sync-pr-to-notion.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-pr-to-notion.yml b/.github/workflows/sync-pr-to-notion.yml index 5085b26..718bd28 100644 --- a/.github/workflows/sync-pr-to-notion.yml +++ b/.github/workflows/sync-pr-to-notion.yml @@ -26,7 +26,7 @@ jobs: - uses: actions/setup-node@v3 with: - node-version: 22 + node-version: 22.17.1 cache: 'pnpm' - uses: pnpm/action-setup@v2 From 4ebb803bd7f1c4023942cb5dda6d0c653b350856 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 19:31:51 +0900 Subject: [PATCH 05/13] refactor: remove cache pnpm --- .github/workflows/sync-pr-to-notion.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sync-pr-to-notion.yml b/.github/workflows/sync-pr-to-notion.yml index 718bd28..50f4624 100644 --- a/.github/workflows/sync-pr-to-notion.yml +++ b/.github/workflows/sync-pr-to-notion.yml @@ -27,7 +27,6 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 22.17.1 - cache: 'pnpm' - uses: pnpm/action-setup@v2 with: From 02521a6d8034377f89ee71e07ced062507b7a883 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 19:49:45 +0900 Subject: [PATCH 06/13] feat: add debug --- scripts/sync-notion.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 373c3ff..a2c3c04 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -12,6 +12,11 @@ async function run() { const propStatus = "상태"; const propPR = "GitHub Pull Requests"; + // 데이터베이스 정보 받아오기 (속성 타입 포함) + const dbInfo = await notion.databases.retrieve({ database_id: dbId }); + console.log("Database properties info:", JSON.stringify(dbInfo.properties, null, 2)); + + const { pull_request: pr } = github.context.payload as any; if (!pr) throw new Error("No pull request context available"); From 36e9f60cf992b99663663c002db2ec76ea30fce8 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:05:04 +0900 Subject: [PATCH 07/13] feat: add debugging --- scripts/sync-notion.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index a2c3c04..432e47a 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -28,12 +28,15 @@ async function run() { if (!match) throw new Error("No matching document ID in branch name"); const documentId = match[1]; + console.log("propId", propId) + console.log("title", documentId) + // 🔍 Find the Notion page with the matching ID const searchResult = await notion.databases.query({ database_id: dbId, filter: { property: propId, - rich_text: { + title: { equals: documentId, }, }, From 032b62974ad25e355bd1d2059d6eeb8c0b76fa5f Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:10:46 +0900 Subject: [PATCH 08/13] feat: add debugging --- scripts/sync-notion.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 432e47a..7d33e4d 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -36,12 +36,14 @@ async function run() { database_id: dbId, filter: { property: propId, - title: { + rich_text: { equals: documentId, }, }, }); + console.log("searchReasult", searchResult) + if (searchResult.results.length === 0) { throw new Error(`No Notion page found with ID: ${documentId}`); } From 9f6c6a1d992a1baf58abbf180837c99812a40fc9 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:24:11 +0900 Subject: [PATCH 09/13] feat: add debugging --- scripts/sync-notion.ts | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 7d33e4d..75978fd 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -28,27 +28,34 @@ async function run() { if (!match) throw new Error("No matching document ID in branch name"); const documentId = match[1]; - console.log("propId", propId) - console.log("title", documentId) - // 🔍 Find the Notion page with the matching ID - const searchResult = await notion.databases.query({ + const allPages = await notion.databases.query({ database_id: dbId, - filter: { - property: propId, - rich_text: { - equals: documentId, - }, - }, + page_size: 100, + sorts: [ + { + property: "created_time", + direction: "descending", + } + ] }); + console.log("allPages", allPages) + + const searchResult = allPages.results.find((page: any) => { + const idProp = page.properties[propId] + if(!idProp || idProp.type !== 'unique_id') return false; + const fullId = idProp.unique_id?.prefix + idProp.unique_id?.number; + return fullId === documentId; + }) + console.log("searchReasult", searchResult) - if (searchResult.results.length === 0) { + if (!searchResult) { throw new Error(`No Notion page found with ID: ${documentId}`); } - const pageId = searchResult.results[0].id; + const pageId = searchResult.id; // 📝 Update the page const update: any = { From cb95e995f8ba49749a1d409ba6e9b43d4b2b108c Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:25:25 +0900 Subject: [PATCH 10/13] =?UTF-8?q?feat:=20=EA=B2=80=EC=83=89=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/sync-notion.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 75978fd..78e2582 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -34,7 +34,7 @@ async function run() { page_size: 100, sorts: [ { - property: "created_time", + property: "생성 일시", direction: "descending", } ] From 1d3515c51754d0c70fecfc970c1a6644b0d60480 Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:28:45 +0900 Subject: [PATCH 11/13] feat: add debugging --- scripts/sync-notion.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 78e2582..5a31315 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -40,7 +40,8 @@ async function run() { ] }); - console.log("allPages", allPages) + console.log("allPages[0]", allPages.results[0]) + console.log("allPages[0]", allPages.results[0].properties) const searchResult = allPages.results.find((page: any) => { const idProp = page.properties[propId] From 9a5f91b8c9f0d5a5042d90609f8c4fb855449a5a Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:32:49 +0900 Subject: [PATCH 12/13] =?UTF-8?q?refactor:=20=ED=95=84=ED=84=B0=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/sync-notion.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index 5a31315..f62a6ed 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -39,14 +39,11 @@ async function run() { } ] }); - - console.log("allPages[0]", allPages.results[0]) - console.log("allPages[0]", allPages.results[0].properties) - + const searchResult = allPages.results.find((page: any) => { const idProp = page.properties[propId] if(!idProp || idProp.type !== 'unique_id') return false; - const fullId = idProp.unique_id?.prefix + idProp.unique_id?.number; + const fullId = idProp.unique_id?.prefix + "-" + idProp.unique_id?.number; return fullId === documentId; }) From 863b19af08d3e0ff0e7b07645637e7cbf7b2dfda Mon Sep 17 00:00:00 2001 From: sezeme Date: Sun, 3 Aug 2025 20:36:44 +0900 Subject: [PATCH 13/13] =?UTF-8?q?refactor:=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EB=A1=9C=EC=A7=81=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/sync-notion.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/sync-notion.ts b/scripts/sync-notion.ts index f62a6ed..6beac73 100644 --- a/scripts/sync-notion.ts +++ b/scripts/sync-notion.ts @@ -20,6 +20,9 @@ async function run() { const { pull_request: pr } = github.context.payload as any; if (!pr) throw new Error("No pull request context available"); + + console.log("pr", pr) + const branch = pr.head.ref; const prUrl = pr.html_url; const prState = pr.merged ? "완료" : pr.state === "open" ? "진행 중" : ""; @@ -39,7 +42,7 @@ async function run() { } ] }); - + const searchResult = allPages.results.find((page: any) => { const idProp = page.properties[propId] if(!idProp || idProp.type !== 'unique_id') return false; @@ -65,7 +68,7 @@ async function run() { }; if (prState) { update.properties[propStatus] = { - select: { name: prState }, + status: { name: prState }, }; }