-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathupdate-extensions-repository.yml
More file actions
75 lines (63 loc) · 2.34 KB
/
Copy pathupdate-extensions-repository.yml
File metadata and controls
75 lines (63 loc) · 2.34 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Update LMS Plugin Repository
on:
schedule:
- cron: "06 */6 * * *"
workflow_dispatch:
env:
MAX_REMOVAL_DIFF: 3
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
merge:
name: Update plugin repository
runs-on: ubuntu-24.04
steps:
- name: Install depedencies
if: ${{ !env.ACT }}
uses: awalsh128/cache-apt-pkgs-action@v1.6.1
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@v6
- name: Cache downloads
uses: actions/cache/restore@v5
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: Save downloads cache
uses: actions/cache/save@v5
with:
path: .download-cache
key: lms-extensions-repo-${{ hashFiles('extensions.xml') }}
- 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 "noreply-gitmaster@lms-community.org"
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@v8
with:
branch: autoupdate
delete-branch: true
title: "LMS Extensions Repository Update: ${{ github.sha }}"
commit-message: "LMS Extensions Repository Update: ${{ github.sha }}"