-
Notifications
You must be signed in to change notification settings - Fork 17
48 lines (40 loc) · 1.5 KB
/
update-extensions-repository.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
run: sudo apt-get install libjson-perl libxml-simple-perl libwww-perl
- name: Checkout
uses: actions/checkout@v4
- 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 [ -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 }}"