Export labels #36
This file contains 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: Export labels | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- ".github/workflows/label_export.yml" | |
- "label_export/export_annotations.py" | |
- "label_export/requirements.txt" | |
pull_request: | |
paths: | |
- ".github/workflows/label_export.yml" | |
- "label_export/export_annotations.py" | |
- "label_export/requirements.txt" | |
# Also run on a schedule, running every sunday at 03:00 | |
schedule: | |
- cron: "0 3 * * 0" | |
# Also run on a manual trigger | |
workflow_dispatch: | |
jobs: | |
export_labels: | |
runs-on: ubuntu-latest | |
name: Export labels | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5.1.1 | |
with: | |
python-version: "3.x" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ./requirements.txt | |
working-directory: ./label_export | |
- name: Export labels with children | |
run: python ./export_annotations.py --annotations-csv=False --annotations-json=../json_files/annotations_with_children.json --fetch-children=True | |
working-directory: ./label_export | |
- name: Export labels without children | |
run: python ./export_annotations.py --annotations-csv=False --annotations-json=../json_files/annotations.json --fetch-children=False | |
working-directory: ./label_export | |
- name: Upload labels JSON | |
uses: actions/upload-artifact@v4.3.4 | |
with: | |
name: labels | |
path: ./json_files/annotations.json | |
- name: Upload labels with children JSON | |
uses: actions/upload-artifact@v4.3.4 | |
with: | |
name: labels_with_children | |
path: ./json_files/annotations_with_children.json | |
- name: Commit and push changes | |
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: "Exported labels" | |
permissions: | |
contents: write |