Skip to content

Commit d01e84e

Browse files
Kumari LadliKumari Ladli
authored andcommitted
Merge workflow updates from notion-to-github
2 parents a27ccec + 82e396d commit d01e84e

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/notion-sync.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Notion to GitHub Branch
2+
3+
# Run every hour or manually
4+
on:
5+
schedule:
6+
- cron: '0 * * * *' # every hour
7+
workflow_dispatch: # allows manual trigger
8+
9+
jobs:
10+
sync:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
16+
steps:
17+
# Step 1: Checkout repo
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
# Step 2: Setup Node.js
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: '20'
26+
27+
# Step 3: Install dependencies
28+
- name: Install dependencies
29+
run: npm install
30+
31+
# Step 4: Run the Notion sync script
32+
- name: Run Notion sync
33+
run: node sync_notion.js
34+
env:
35+
NOTION_TOKEN: ${{ secrets.NOTION_TOKEN }}
36+
37+
# Step 5: Commit and push to notion-to-github branch
38+
- name: Commit and push to branch
39+
run: |
40+
git config user.name "GitHub Actions"
41+
git config user.email "actions@github.com"
42+
git checkout -B notion-to-github
43+
git add .
44+
git diff --quiet && git diff --staged --quiet || git commit -m "Sync from Notion $(date +%Y-%m-%d)"
45+
git push -f origin notion-to-github
46+
47+
# Step 6: Create Pull Request
48+
- name: Create Pull Request
49+
uses: repo-sync/pull-request@v2
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
source_branch: notion-to-github
53+
destination_branch: main
54+
pr_title: "Sync from Notion - $(date +%Y-%m-%d)"
55+
pr_body: "Automated sync from Notion workspace"
56+
pr_allow_empty: false

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.env
2+
node_modules/

0 commit comments

Comments
 (0)