-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
import-notebooks.yml
54 lines (50 loc) · 1.94 KB
/
import-notebooks.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
# Hugo Blox GitHub Action to import Jupyter Notebooks as blog posts
name: Import Jupyter Notebooks as Blog Posts
# Require permission to create a PR
permissions:
contents: write
pull-requests: write
# Run workflow when a `.bib` file is added or updated in the `data/` folder
on:
push:
branches: ['main']
paths: ['notebooks/*.ipynb']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
hugoblox:
if: github.repository_owner != 'HugoBlox'
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install academic==0.11.2
- name: Run Academic Converter Tool
run: academic import 'notebooks/*.ipynb' content/post/ --verbose
- name: Create Pull Request
# Set ID for `Check outputs` stage
id: cpr
uses: peter-evans/create-pull-request@v5
with:
commit-message: 'content: import blog posts from `notebooks/` folder'
title: Hugo Blox Builder - Import latest blog posts
body: |
Convert Jupyter Notebooks in the `notebooks/` folder into blog posts in the `content/post/` folder.
将`notebooks/`文件夹中的Jupyter笔记本转换为`content/post/`文件夹中的博客帖子。
[View Documentation](https://github.com/GetRD/academic-file-converter)
base: main
labels: automated-pr, content
branch: hugoblox-import-posts
delete-branch: true
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"