From 2f07fb525928ee80c399301906cd2ef750b8e857 Mon Sep 17 00:00:00 2001 From: Abhi <85984486+AbhiTheModder@users.noreply.github.com> Date: Thu, 5 Dec 2024 01:54:02 +0530 Subject: [PATCH] [CI] Automate Modules update --- .github/workflows/update_modules.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/update_modules.yml diff --git a/.github/workflows/update_modules.yml b/.github/workflows/update_modules.yml new file mode 100644 index 0000000..6ad79ab --- /dev/null +++ b/.github/workflows/update_modules.yml @@ -0,0 +1,47 @@ +name: Update Modules + +on: + repository_dispatch: + types: + - custom-modules-updated + +jobs: + update-modules: + runs-on: ubuntu-latest + + steps: + - name: Checkout Main repository + uses: actions/checkout@v3 + + - name: Checkout Modules repository + uses: actions/checkout@v3 + with: + repository: The-MoonTg-project/custom_modules + path: custom_modules + + - name: Update file + run: | + ls -R + cd custom_modules + printf "%s\n" "$(ls -d */*)" | sed 's/\.py$//' > ../modules/full.txt + cd .. + rm -rf custom_modules/ + + - name: Commit changes + run: | + git add ./modules/full.txt + if git diff --cached --quiet; then + echo "No changes to commit." + exit 0 + fi + echo "new_modules_available=true" >> $GITHUB_ENV + + - name: Create Pull Request + if: success() && env.new_modules_available == 'true' + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Update modules/full.txt" + branch: update-modules-file + title: "Update for custom_modules" + body: "This PR updates the modules/full.txt file with the latest changes."