Update LMS Plugin Repository #8088
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update LMS Plugin Repository | |
| on: | |
| schedule: | |
| - cron: "06 */6 * * *" | |
| workflow_dispatch: | |
| env: | |
| MAX_REMOVAL_DIFF: 3 | |
| jobs: | |
| merge: | |
| name: Update plugin repository | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Install depedencies | |
| if: ${{ !env.ACT }} | |
| uses: awalsh128/cache-apt-pkgs-action@latest | |
| with: | |
| packages: libjson-perl libxml-simple-perl libwww-perl | |
| version: 1 | |
| - name: Install depedencies (ACT mode) | |
| if: ${{ env.ACT }} | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libjson-perl libxml-simple-perl libwww-perl | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Cache downloads | |
| uses: actions/cache@v4 | |
| with: | |
| path: .download-cache | |
| key: lms-extensions-repo-${{ hashFiles('extensions.xml') }} | |
| restore-keys: lms-extensions-repo | |
| - name: Merge repository files | |
| id: merge | |
| run: | | |
| perl buildrepo.pl | |
| echo "name=LMS_REPO_DIFF_VALUE::$(git diff --numstat | fgrep extensions.xml | awk '{ print $2-$1 }') >> $GITHUB_OUTPUT" | |
| - name: Push Changes (if needed and reasonable) | |
| if: steps.merge.outputs.LMS_REPO_DIFF_VALUE < env.MAX_REMOVAL_DIFF | |
| run: | | |
| if [ "$ACT" == "true" ]; then | |
| echo "Running in ACT mode, skipping git push" | |
| elif [ -z "$(git status --porcelain)" ]; then | |
| echo No changes to commit | |
| else | |
| git config user.name "LMS Extensions Repository Updater" | |
| git config user.email "[email protected]" | |
| git commit -a -m "Update Extensions Repository ${{ github.event.inputs.version }}" | |
| git push | |
| fi | |
| - name: Create Pull Request (if needed) | |
| if: steps.merge.outputs.LMS_REPO_DIFF_VALUE >= env.MAX_REMOVAL_DIFF | |
| uses: peter-evans/create-pull-request@v4 | |
| with: | |
| branch: autoupdate | |
| delete-branch: true | |
| title: "LMS Extensions Repository Update: ${{ github.sha }}" | |
| commit-message: "LMS Extensions Repository Update: ${{ github.sha }}" | |