gradio/.github/workflows/report-notebook-status-pr.yml
2023-09-07 12:28:52 -07:00

47 lines
1.9 KiB
YAML

on:
workflow_run:
workflows: [Check Demos Match Notebooks]
types: [completed]
jobs:
get-pr-number:
runs-on: ubuntu-latest
outputs:
pr_number: ${{ steps.pr_number.outputs.pr_number }}
steps:
- uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install pip
run: python -m pip install requests
- name: Download metadata
run: python scripts/download_artifacts.py ${{github.event.workflow_run.id }} metadata.json ${{ secrets.COMMENT_TOKEN }} --owner ${{ github.repository_owner }}
- run: unzip metadata.json.zip
- name: Pipe metadata to env
id: pr_number
run: echo "pr_number=$(python -c 'import json; print(json.load(open("metadata.json"))["pr_number"])')" >> $GITHUB_OUTPUT
comment-success:
uses: "./.github/workflows/comment-queue.yml"
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.name == 'Check Demos Match Notebooks'}}
needs: get-pr-number
secrets:
gh_token: ${{ secrets.COMMENT_TOKEN }}
with:
pr_number: ${{ needs.get-pr-number.outputs.pr_number }}
message: notebooks~success~null
comment-failure:
uses: "./.github/workflows/comment-queue.yml"
if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.name == 'Check Demos Match Notebooks'}}
needs: get-pr-number
secrets:
gh_token: ${{ secrets.COMMENT_TOKEN }}
with:
pr_number: ${{ needs.get-pr-number.outputs.pr_number }}
message: notebooks~failure~https://github.com/gradio-app/gradio/actions/runs/${{github.run_id}}/
additional_text: |
The demo notebooks don't match the run.py files. Please run this command from the root of the repo and then commit the changes:
```bash
pip install nbformat && cd demo && python generate_notebooks.py
```