-
Notifications
You must be signed in to change notification settings - Fork 69
86 lines (83 loc) · 2.64 KB
/
notebooks.yml
File metadata and controls
86 lines (83 loc) · 2.64 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Labelbox Example Notebook Workflow
on:
push:
branches: [develop]
paths:
- examples/**
pull_request:
branches: [develop]
paths:
- examples/**
permissions:
contents: write
pull-requests: write
jobs:
# Get installs from rye and run rye run clean to format
format:
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: ./.github/actions/python-package-shared-setup
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: 3.12
- name: Format
working-directory: examples
run: rye run clean
- name: Commit changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add examples/.
git commit -m ":art: Cleaned" || exit 0
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}
# See if notebooks were added or deleted (name change counts as both)
changes:
needs: format
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest
outputs:
addedOrModified: ${{ steps.filter.outputs.addedOrModified }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
addedOrModified:
- added|deleted: 'examples/**/*.ipynb'
# Create readme if the above job shows true using rye run create-readme
create:
needs: changes
if: ${{ needs.changes.outputs.addedOrModified == 'true' }} && github.event.pull_request.merged == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: ./.github/actions/python-package-shared-setup
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: 3.12
- name: Create readme
working-directory: examples
run: rye run create-readme
- name: Commit changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add examples/.
git commit -m ":memo: README updated" || exit 0
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.head_ref }}