refactor: replace YAML schema check with a dispatch call (#3482)

* Replace yaml check with a dispatch call

* split workflow

* add branch for testing

* access secrets properly

* remove testing branch trigger
This commit is contained in:
Sara Zan 2022-10-28 10:48:59 +02:00 committed by GitHub
parent 8db7dfb884
commit f377b78263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 48 deletions

View File

@ -1,16 +1,12 @@
name: Schemas
name: OpenAPI Schema
on:
workflow_dispatch: # Activate this workflow manually
pull_request:
push:
branches:
# release branches have the form v1.9.x
- 'v[0-9].*[0-9].x'
jobs:
openapi:
run:
runs-on: ubuntu-latest
steps:
@ -56,45 +52,3 @@ jobs:
echo "###################################################################################################"
exit 1
fi
pipeline-yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Python
uses: ./.github/actions/python_cache/
- name: Install sndfile
run: sudo apt update && sudo apt-get install libsndfile1 ffmpeg
- name: Install Haystack
run: |
pip install --upgrade pip
pip install -U .[all]
- name: Update pipeline YAML schemas
run: python .github/utils/generate_json_schema.py
- name: Check status
run: |
if [[ `git status --porcelain` ]]; then
git status
echo "##################################################################################################"
git diff
echo "##################################################################################################"
echo "# "
echo "# CHECK FAILED! The YAML schemas for pipelines were not updated."
echo "# "
echo "# Please generate the new schemas locally:"
echo "# "
echo "# python .github/utils/generate_json_schema.py"
echo "# "
echo "# Or see https://github.com/deepset-ai/haystack/blob/main/CONTRIBUTING.md for help."
echo "# "
echo "# If you have further problems, please open an issue: https://github.com/deepset-ai/haystack/issues"
echo "# "
echo "##################################################################################################"
exit 1
fi

23
.github/workflows/pipeline_schema.yml vendored Normal file
View File

@ -0,0 +1,23 @@
name: YAML Schema
on:
workflow_dispatch: # Activate this workflow manually
push:
branches:
- main
jobs:
run:
runs-on: ubuntu-latest
steps:
# Start a workflow in https://github.com/deepset-ai/haystack-json-schema
# https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event
- name: Dispatch to schemas repository
run: |
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.HAYSTACK_BOT_TOKEN }}" \
https://api.github.com/repos/deepset-ai/haystack-json-schema/dispatches \
-d '{"event_type":"generate-pipeline-schemas","client_payload":{}}'