-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (55 loc) · 2.12 KB
/
github-actions-example.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
on: [workflow_dispatch]
name: GitHub Actions Ipynb for preflight
jobs:
preflight:
runs-on: ubuntu-latest
name: Ipynb for preflight
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: Extract branch name
shell: bash
run: echo "GitHub ref_name ${{ github.ref_name }}"
id: extract_branch
- name: preflight
id: preflight
uses: c2dh/journal-of-digital-history-ipynb-preflight-action@master
with:
notebook: 'example/plotly.ipynb'
functions: 'checkkernel,checkcitation,checkhtml,checkoutput,checktags,checkurls,checkjavascript'
output_md: 'report.md'
- name: nbconvert run
run: |
python -m pip install jupyter nbconvert nbformat
jupyter nbconvert --execute --to notebook --inplace --ExecutePreprocessor.timeout=-1 article.ipynb
# Use the output from the `preflight` step
- name: Use the output
run: echo "Notebook path ${{ steps.preflight.outputs.notebook_path }} - workspace ${{ steps.preflight.outputs.workspace }}"
- name: commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: '*.md'
- name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const result = await github.rest.pulls.create({
title: '[Example] Simple demo',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'develop',
body: [
'This PR is auto-generated by',
'[actions/github-script](https://github.com/actions/github-script).'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['feature', 'automated pr']
});
- name: Run shell cmd
run: echo "Preflight check on https://github.com/${{github.repository}}/blob/${{github.ref_name}}/${{steps.preflight.outputs.notebook}}"