-
Notifications
You must be signed in to change notification settings - Fork 7
79 lines (67 loc) · 2.25 KB
/
update-submodules.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Update Submodules
on:
push:
branches: [ dev ]
schedule:
- cron: '0 0 * * *'
jobs:
check_submodules:
name: Check Submodules
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check.outputs.has_changes }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- 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:
- name: Setup Python 3.10.4
uses: actions/setup-python@v3
with:
python-version: '3.10.4'
- name: Setup Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.8.2
- name: Install Dependencies
run: |
poetry install --no-root
- name: Update Submodule
run: |
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
- name: Execute pre-commit
continue-on-error: true
run: |
poetry run python -m pre_commit run --all-files
- name: Push changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git checkout -b $GITHUB_RUN_ID
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})`,
body: `Please add the version tag to trigger the release.`,
});