2024-04-27 20:20:14 +02:00
|
|
|
name: Update Submodules
|
|
|
|
|
|
|
|
on:
|
2024-04-27 21:36:27 +02:00
|
|
|
push:
|
|
|
|
branches: [ dev ]
|
2024-04-27 20:20:14 +02:00
|
|
|
schedule:
|
|
|
|
- cron: '0 0 * * *'
|
|
|
|
|
|
|
|
jobs:
|
2024-04-27 21:36:27 +02:00
|
|
|
check_submodules:
|
|
|
|
name: Check Submodules
|
2024-04-27 20:20:14 +02:00
|
|
|
runs-on: ubuntu-latest
|
2024-04-27 21:36:27 +02:00
|
|
|
outputs:
|
|
|
|
has_changes: ${{ steps.check.outputs.has_changes }}
|
2024-04-27 20:20:14 +02:00
|
|
|
steps:
|
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
2024-04-27 21:36:27 +02:00
|
|
|
- name: Create new branch and push changes
|
|
|
|
run: |
|
|
|
|
git submodule update --remote
|
|
|
|
|
|
|
|
- name: Check for changes
|
|
|
|
id: check
|
|
|
|
run: |
|
|
|
|
git diff --quiet || echo "::set-output name=has_changes::true"
|
|
|
|
|
|
|
|
update_submodules:
|
|
|
|
name: Update Submodules
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [check_submodules]
|
|
|
|
if: needs.check_submodules.outputs.has_changes == 'true'
|
|
|
|
steps:
|
|
|
|
|
2024-04-27 20:20:14 +02:00
|
|
|
- name: Setup Python 3.10.4
|
|
|
|
uses: actions/setup-python@v3
|
|
|
|
with:
|
|
|
|
python-version: '3.10.4'
|
|
|
|
|
2024-04-27 21:36:27 +02:00
|
|
|
- name: Setup Poetry
|
|
|
|
uses: abatilo/actions-poetry@v3
|
|
|
|
with:
|
|
|
|
poetry-version: 1.8.2
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
2024-04-27 20:20:14 +02:00
|
|
|
run: |
|
2024-04-27 21:36:27 +02:00
|
|
|
poetry install --no-root
|
2024-04-27 20:20:14 +02:00
|
|
|
|
2024-04-27 21:36:27 +02:00
|
|
|
- name: Update Submodule
|
2024-04-27 20:20:14 +02:00
|
|
|
run: |
|
2024-04-27 21:36:27 +02:00
|
|
|
datamodel-codegen --input ./compose-spec/schema/compose-spec.json --output-model-type pydantic_v2.BaseModel --field-constraints --output ./compose_viz/spec/compose_spec.py
|
|
|
|
poetry run python ./update-submodules.py
|
2024-04-27 20:20:14 +02:00
|
|
|
|
2024-04-27 21:36:27 +02:00
|
|
|
- name: Execute pre-commit
|
|
|
|
continue-on-error: true
|
2024-04-27 20:20:14 +02:00
|
|
|
run: |
|
2024-04-27 21:36:27 +02:00
|
|
|
poetry run python -m pre_commit run --all-files
|
2024-04-27 20:20:14 +02:00
|
|
|
|
|
|
|
- name: Push changes
|
|
|
|
run: |
|
2024-04-27 21:36:27 +02:00
|
|
|
git config user.name github-actions
|
|
|
|
git config user.email github-actions@github.com
|
|
|
|
git checkout -b $GITHUB_RUN_ID
|
2024-04-27 20:20:14 +02:00
|
|
|
git commit -am "chore: update submodules"
|
|
|
|
git push --set-upstream origin $GITHUB_RUN_ID
|
|
|
|
|
|
|
|
- name: File PR
|
|
|
|
uses: actions/github-script@v7
|
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
script: |
|
|
|
|
await github.rest.pulls.create({
|
|
|
|
owner: '${{ github.repository_owner }}',
|
|
|
|
repo: 'compose-viz',
|
|
|
|
head: process.env.GITHUB_RUN_ID,
|
|
|
|
base: 'main',
|
|
|
|
title: `chore: update submodules (${process.env.GITHUB_RUN_ID})`,
|
2024-04-27 21:36:27 +02:00
|
|
|
body: `Please add the version tag to trigger the release.`,
|
2024-04-27 20:20:14 +02:00
|
|
|
});
|