-
Notifications
You must be signed in to change notification settings - Fork 50
45 lines (38 loc) · 1.29 KB
/
pull_request.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
name: Check Added Submodules
on:
pull_request:
branches:
- main
jobs:
style:
name: Run StyLua
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
name: Checkout LLS-Addons
with:
submodules: false
- name: Fetch Base Branch
run: |
# Fetch all history for the base branch and PR head
git fetch origin ${{ github.base_ref }} --depth=1
git fetch origin ${{ github.head_ref }} --depth=1
- name: Detect Added Submodules
run: |
BASE_REF=${{ github.event.pull_request.base.sha }}
HEAD_REF=${{ github.event.pull_request.head.sha }}
ADDED_SUBMODULES=$(git diff --submodule ${BASE_REF}..${HEAD_REF} | grep '^Submodule' | awk '{ print $2 }')
echo "Added submodules: $ADDED_SUBMODULES"
echo "ADDED_SUBMODULES=$ADDED_SUBMODULES" >> $GITHUB_ENV
- name: Fetch submodules
run: |
for submodule in $ADDED_SUBMODULES; do
echo "Getting submodule: $submodule"
git submodule update --init --recursive $submodule
done
- uses: JohnnyMorganz/[email protected]
name: Run StyLua
with:
token: ${{ secrets.GITHUB_TOKEN }}
version: latest
args: --check addons