mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
69680b5827
* chore(deps): update actions/upload-artifact action to v4 * Use download v4 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co> Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
50 lines
1.6 KiB
YAML
50 lines
1.6 KiB
YAML
# This workflow will check if the run.py files in every demo match the run.ipynb notebooks.
|
|
|
|
name: Check Demos Match Notebooks
|
|
|
|
on:
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
paths:
|
|
- 'demo/**'
|
|
|
|
jobs:
|
|
comment-notebook-start:
|
|
uses: "./.github/workflows/comment-queue.yml"
|
|
secrets:
|
|
gh_token: ${{ secrets.COMMENT_TOKEN }}
|
|
with:
|
|
pr_number: ${{ github.event.pull_request.number }}
|
|
message: notebooks~pending~null
|
|
check-notebooks:
|
|
name: Generate Notebooks and Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
- name: Generate Notebooks
|
|
run: |
|
|
pip install nbformat && cd demo && python generate_notebooks.py
|
|
- name: Print Git Status
|
|
run: echo $(git status) && echo $(git diff)
|
|
- name: Assert Notebooks Match
|
|
id: assertNotebooksMatch
|
|
run: git status | grep "nothing to commit, working tree clean"
|
|
- name: Get PR Number
|
|
if: always()
|
|
run: |
|
|
python -c "import os;print(os.environ['GITHUB_REF'].split('/')[2])" > pr_number.txt
|
|
echo "PR_NUMBER=$(cat pr_number.txt)" >> $GITHUB_ENV
|
|
- name: Upload PR Number
|
|
if: always()
|
|
run: |
|
|
python -c "import json; json.dump({'pr_number': ${{ env.PR_NUMBER }}}, open('metadata.json', 'w'))"
|
|
- name: Upload metadata
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: metadata.json
|
|
path: metadata.json |