diff --git a/.github/workflows/update-submodule-files.yml b/.github/workflows/update-submodule-files.yml new file mode 100644 index 0000000..f155679 --- /dev/null +++ b/.github/workflows/update-submodule-files.yml @@ -0,0 +1,37 @@ +name: Update Submodule Files + +on: + pull_request: + types: [opened, synchronize] + branches: + - main + +jobs: + update-files: + if: github.actor == 'dependabot[bot]' && github.event.pull_request.head.ref == 'dependabot/*-gitsubmodule-*' + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run update script + run: python update_repo.py + + - name: Commit and push changes + run: | + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add . + git commit -m "Update files based on submodule changes" + git push diff --git a/.github/workflows/update_from_submodule.yml b/.github/workflows/update_from_submodule.yml deleted file mode 100644 index 93f8268..0000000 --- a/.github/workflows/update_from_submodule.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Update Submodule Changes - -# Trigger the workflow on push events to Dependabot branches -on: - push: - branches: - - 'dependabot/**' - -jobs: - update-file-after-submodule: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - - name: Run Update Script - run: | - chmod +x ./update_repo.py - ./update_repo.py - - - name: Configure Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions@github.com" - - - name: Commit Changes - run: | - git add . - git commit -m "Update file after submodule update" || echo "No changes to commit" - - - name: Push Changes - run: | - git push origin HEAD:update-file-after-submodule - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - commit-message: "Update file after submodule update" - title: "Update File After Submodule Update" - body: | - This pull request updates the relevant files after a submodule update by Dependabot. - base: main - head: update-file-after-submodule - -