From 59c76fc09a6ea49bd19d0174bc841f2e698e363f Mon Sep 17 00:00:00 2001 From: Lucie Milan Date: Fri, 13 Oct 2023 15:42:42 +0200 Subject: [PATCH] add foreign keys workflow --- .github/workflows/generate_foreign_keys.yml | 42 +++++++++++++++++++ .../get_json_schema_from_catalog.yml | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/generate_foreign_keys.yml diff --git a/.github/workflows/generate_foreign_keys.yml b/.github/workflows/generate_foreign_keys.yml new file mode 100644 index 000000000..9e95e53d6 --- /dev/null +++ b/.github/workflows/generate_foreign_keys.yml @@ -0,0 +1,42 @@ +name: Generate foreign keys +on: + push: + paths: + - '**-foreign-keys.yml' + branches: + - '!master' + +jobs: + generate-foreign-keys: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.9' + + - name: Install Python modules + uses: BSFishy/pip-action@v1 + with: + packages: | + pyyaml + + - name: Generate foreign keys + run: python generate_foreign_keys.py + working-directory: ./scripts/json + + - name: Check for changes + id: get_changes + run: echo "::set-output name=changed::$(git status --porcelain | wc -l)" + + - name: Commit changes + if: steps.get_changes.outputs.changed != 0 + run: | + git add -A + git config --global user.email "github-actions@github.com" + git config --global user.name 'github-actions' + git commit -am "Automated commit: Generate JSON schemas" + git push diff --git a/.github/workflows/get_json_schema_from_catalog.yml b/.github/workflows/get_json_schema_from_catalog.yml index 6308d856d..d3f694627 100644 --- a/.github/workflows/get_json_schema_from_catalog.yml +++ b/.github/workflows/get_json_schema_from_catalog.yml @@ -48,7 +48,7 @@ jobs: uses: BSFishy/pip-action@v1 with: packages: | - requests + pyyaml - name: Get JSON files run: python manual_json_import.py ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.tap }} ${{ github.event.inputs.version }} ${{ github.event.inputs.file }}