-
Notifications
You must be signed in to change notification settings - Fork 12
49 lines (43 loc) · 1.5 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
46
47
48
49
name: Pull Request
on:
pull_request:
branches: '*'
jobs:
check-changes:
runs-on: ubuntu-latest
name: Check Changed Files
outputs:
modules: ${{ steps.build-matrix.outputs.modules }}
steps:
- uses: actions/checkout@v4
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v42
with:
files: packages/**/package.json
- name: Build matrix input
id: build-matrix
if: ${{ steps.changed-files.outputs.all_changed_files }} != '[]'
run: |
set +e
modules_list=()
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
./bin/check-version-bump.sh ./"$file"
# check-version-bump exits with 0 if it detects a bump, otherwise with 1
if [ $? != "1" ] && [[ ! " ${modules_list[*]} " =~ " ${file} " ]]; then
modules_list+=("${file%"/package.json"}")
fi
done
jsonString="$(jq --compact-output --null-input '$ARGS.positional' --args -- "${modules_list[@]}")"
echo "modules=$jsonString" >> $GITHUB_OUTPUT
trigger-lint:
name: Run Lint Checks
uses: ./.github/workflows/lint.yml
trigger-unit-test:
name: Run Unit Tests
permissions:
pull-requests: write
needs: [ check-changes ]
if: ${{ needs.check-changes.outputs.modules != '' && toJson(fromJson(needs.check-changes.outputs.modules)) != '[]' }}
uses: ./.github/workflows/unit-test.yml
secrets: inherit