-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
56 lines (51 loc) · 1.64 KB
/
action.yaml
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
name: Sync Notion to GitHub
author: YouXam
branding:
icon: 'arrow-down-circle'
color: 'blue'
description: 'This is a GitHub Action that syncs Notion to GitHub.'
inputs:
notion_token:
description: 'The notion api token.'
required: true
author:
description: "Articles's author. If left blank, then get from notion."
required: false
subdir:
description: 'Whether to use subfolders to organize each article.'
required: false
default: true
runs:
using: 'composite'
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
path: "github"
- name: Checkout repository
uses: actions/checkout@v2
with:
repository: 'YouXam/Notion-GitHub-Sync'
path: "notion-sync"
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install pyyaml notion2md notion_client python-dateutil python-slugify requests
- name: Sync Notion to Github
shell: bash
run: |
SUBDIR=${{ inputs.subdir }} python ${{ github.workspace }}/notion-sync/main.py ${{ github.workspace }}/github/ ${{ inputs.notion_token }} ${{ inputs.author }}
- name: Commit and push if changes
shell: bash
run: |
cd ${{ github.workspace }}/github/
git config --global user.name 'GitHub Actions'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add -A
git diff --quiet && git diff --staged --quiet || git commit -F /tmp/changelog
git push