File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -20,25 +20,22 @@ jobs:
20
20
- name : Checkout code
21
21
uses : actions/checkout@v4
22
22
with :
23
- fetch-depth : 1
24
-
25
- - name : Fetch main branch
26
- run : git fetch origin main:main # Fetch the main branch reference for comparison
23
+ fetch-depth : 0
27
24
28
25
- name : Identify changed samples
29
26
run : |
30
- # Identify the samples that have changed since the last commit on main
31
- # and save them to a file for later use.
32
- # remove paths to samples which have been renamed or deleted.
33
- git diff --name-only HEAD $(git merge-base main HEAD) \
27
+ git fetch origin main
28
+ LAST_ANCESTOR=$(git merge-base HEAD origin/main)
29
+ git diff --name-only HEAD $LAST_ANCESTOR \
34
30
| grep '^samples/' \
35
31
| awk -F'/' '{print $1"/"$2}' \
36
32
| sort \
37
- | uniq \
38
- | while read -r dir; do [ -d "$dir" ] && echo "$dir"; done > changed_samples.txt
39
- if [ ! -s changed_samples.txt ]; then
33
+ | uniq > changed_samples.txt
34
+ if [ -s changed_samples.txt ]; then
35
+ echo "The following samples have changed:"
36
+ cat changed_samples.txt
37
+ else
40
38
echo "No samples have changed. Exiting..."
41
- exit 0
42
39
fi
43
40
44
41
- name : Install Golang
You can’t perform that action at this time.
0 commit comments