forked from Aspen-Discovery/aspen-discovery
-
Notifications
You must be signed in to change notification settings - Fork 1
94 lines (81 loc) · 3.08 KB
/
pull_request_qa.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
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Check Pull Request for QA Issues
on:
pull_request:
push:
jobs:
check_release_notes:
runs-on: ubuntu-latest
steps:
- name: Checkout pull request branch
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for changes in release notes
run: |
if git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -q 'code/web/release_notes/'; then
echo "Release notes have been modified"
else
echo "::warning::Release notes not modified"
fi
check_tabs_vs_spaces:
runs-on: ubuntu-latest
steps:
- name: Checkout pull request branch
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for spaces instead of tabs
run: |
# Find files that are modified in the pull request
MODIFIED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} | grep -v 'code/aspen_app')
# Loop through each file and check for spaces used instead of tabs
EXIT_CODE=0
declare -A RESULTS
for file in $MODIFIED_FILES; do
echo "Found modified file: $file";
if [[ $file == *.php || $file == *.js || $file == *.java ]]; then
DIFF=$(git diff ${{ github.event.pull_request.base.sha }} -- $file)
#echo "DIFF: $DIFF"
while IFS= read -r RAW_LINE; do
if [[ $RAW_LINE =~ ^\+ ]]; then
LINE=$(echo -e "$RAW_LINE" | sed 's/\t/_TAB_/g')
if [[ $LINE =~ ^\+(_TAB_)*[[:space:]][[:space:]]+ ]]; then
echo "Bad Line: $RAW_LINE"
RESULTS[$file]=1
EXIT_CODE=1
fi
fi
done <<< "$DIFF"
fi
done
if [ $EXIT_CODE -eq 1 ]; then
echo "FILES CONTAINING SPACES INSTEAD OF TABS:"
for key in "${!RESULTS[@]}"; do
echo "$key"
done
else
echo "NO SPACES FOUND!";
fi
exit $EXIT_CODE
check_create_site_for_docker:
runs-on: ubuntu-latest
steps:
- name: Checkout pull request branch
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Check for changes in site creation that may necessitate a change to the Docker file
run: |
LINES_CHANGED=$(git diff ${{ github.event.pull_request.base.sha }} -- install/createSiteTemplate.ini | wc -l)
echo "LINES CHANGED: $LINES_CHANGED"
if [[ $LINES_CHANGED -gt 0 ]]; then
echo "Changes to createSiteTemplate.ini have been detected"
if git diff --name-only git diff --name-only ${{ github.event.pull_request.base.sha }} | grep docker; then
echo "Changes to docker files has also been detected"
else
echo "No changes to docker files have been detected"
exit 1
fi
else
echo "No changes to Aspen or Koha keys have been detected";
fi