Skip to content

[SN-0] Switched notebooks to RYE for better management cleaned up everything #3

[SN-0] Switched notebooks to RYE for better management cleaned up everything

[SN-0] Switched notebooks to RYE for better management cleaned up everything #3

Workflow file for this run

name: Labelbox Example Notebook Format
on:
push:
branches: [develop]
paths:
- examples/**
pull_request:
branches: [develop]
paths:
- examples/**
permissions:
contents: write
pull-requests: write
jobs:
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/notebooks
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: ${{ inputs.python-version }}
- 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 }}
changes:
needs: format
if: github.event.pull_request.merged == false
runs-on: ubuntu-latest
# Set job outputs to values from filter step
outputs:
addedOrModified: ${{ steps.filter.outputs.addedOrModified }}
steps:
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
addedOrModified:
- added|deleted: 'examples/**.ipynb'
create:
needs: changes
if: github.event.pull_request.merged == false && ${{ needs.changes.outputs.addedOrModified == 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: ./.github/actions/notebooks
with:
rye-version: ${{ vars.RYE_VERSION }}
python-version: ${{ inputs.python-version }}
- 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 }}