From 49e3f14191129b9ada55f7fed78a08af45978adf Mon Sep 17 00:00:00 2001 From: Xyphuz Date: Sun, 28 Apr 2024 02:20:14 +0800 Subject: [PATCH] ci: move naming script execution from ci to update-submodules --- .github/workflows/ci.yml | 4 -- .github/workflows/cron.yml | 24 ------------ .github/workflows/update-submodules.yml | 52 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/cron.yml create mode 100644 .github/workflows/update-submodules.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2558da5..6d3b3df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,6 @@ jobs: with: python-version: '3.10.4' - - name: Changing naming convention - run: | - python3 naming.py - - name: Setup Poetry uses: abatilo/actions-poetry@v3 with: diff --git a/.github/workflows/cron.yml b/.github/workflows/cron.yml deleted file mode 100644 index 5230d09..0000000 --- a/.github/workflows/cron.yml +++ /dev/null @@ -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" diff --git a/.github/workflows/update-submodules.yml b/.github/workflows/update-submodules.yml new file mode 100644 index 0000000..5dbb895 --- /dev/null +++ b/.github/workflows/update-submodules.yml @@ -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})`, + });