ci: move naming script execution from ci to update-submodules

This commit is contained in:
Xyphuz 2024-04-28 02:20:14 +08:00
parent b8ea7a88bb
commit 49e3f14191
3 changed files with 52 additions and 28 deletions

View file

@ -25,10 +25,6 @@ jobs:
with: with:
python-version: '3.10.4' python-version: '3.10.4'
- name: Changing naming convention
run: |
python3 naming.py
- name: Setup Poetry - name: Setup Poetry
uses: abatilo/actions-poetry@v3 uses: abatilo/actions-poetry@v3
with: with:

View file

@ -1,24 +0,0 @@
name: Submodule Updates
on:
schedule:
- cron: '0 0 * * *'
jobs:
update_submodules:
name: Submodule update
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Update Submodules
uses: releasehub-com/github-action-create-pr-parent-submodule@v1
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
parent_repository: ${{ github.repository_owner }}/compose-viz
checkout_branch: main
pr_against_branch: main
owner: ${{ github.repository_owner }}
label: "automerge"

52
.github/workflows/update-submodules.yml vendored Normal file
View file

@ -0,0 +1,52 @@
name: Update Submodules
on:
schedule:
- cron: '0 0 * * *'
jobs:
update_submodules:
name: Update Submodules
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Python 3.10.4
uses: actions/setup-python@v3
with:
python-version: '3.10.4'
- name: Changing naming convention
run: |
python3 naming.py
- name: Create new branch and push changes
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git submodule update --remote
- name: Changing naming convention
run: |
python3 naming.py
git checkout -b $GITHUB_RUN_ID
- name: Push changes
run: |
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: `chore: update submodules (${process.env.GITHUB_RUN_ID})`,
});