[SN-153] YOLOv8 notebook #150
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |