-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (55 loc) · 1.92 KB
/
5-sync-notion.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
67
68
name: sync-notion
on:
# push:
# branches:
# - main
schedule:
- cron: "0 20 * * 0-4"
env:
ENABLE_NOTION_SYNC: ${{ vars.ENABLE_NOTION_SYNC }}
KNOWLEDGE_BASE_ID: ${{ vars.KNOWLEDGE_BASE_ID }}
DATA_SOURCE_ID: ${{ vars.DATA_SOURCE_ID }}
AWS_DEST_PATH: ${{ vars.AWS_DEST_PATH }}
NOTION_PAGE_NAME: "nalbam"
NOTION_PAGE_ID: "7aace0412a82431996f61a29225a95ec"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python 3.9 🐍
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Setup Dependencies
run: pip install python-notion-exporter
- name: Run Notion Exporter
if: env.ENABLE_NOTION_SYNC == 'Yes'
env:
NOTION_TOKEN_V2: ${{ secrets.NOTION_TOKEN_V2 }}
NOTION_FILE_TOKEN: ${{ secrets.NOTION_FILE_TOKEN }}
run: |
python bin/notion_exporter.py
- name: Sync to AWS S3 Data Source
if: env.ENABLE_NOTION_SYNC == 'Yes'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
run: |
aws s3 sync --delete \
build/${{ env.NOTION_PAGE_NAME }}/ \
${{ env.AWS_DEST_PATH }}/${{ env.NOTION_PAGE_NAME }}/
- name: Sync to AWS Bedrock Knowledge Base
if: env.ENABLE_NOTION_SYNC == 'Yes' && env.KNOWLEDGE_BASE_ID != 'None' && env.DATA_SOURCE_ID != 'None'
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1"
run: |
aws bedrock-agent start-ingestion-job \
--knowledge-base-id ${{ env.KNOWLEDGE_BASE_ID }} \
--data-source-id ${{ env.DATA_SOURCE_ID }}