2
2
set -e
3
3
4
4
# Set path
5
- WORKPATH=$GITHUB_WORKSPACE /$INPUT_PATH
6
5
HOME=/home/builder
7
- echo " ::group::Copying files from $WORKPATH to $HOME /gh-action"
6
+ echo " ::group::Copying files from $GITHUB_WORKSPACE to $HOME /gh-action"
8
7
# Set path permision
9
8
cd $HOME
10
9
mkdir gh-action
11
10
cd gh-action
12
- cp -rfv " $GITHUB_WORKSPACE " /.git ./
13
- cp -fv " $WORKPATH " /PKGBUILD ./
11
+
12
+ # If there is a custom path, we need to copy the whole repository
13
+ # because we run "git diff" at several stages and without the entire
14
+ # tree the output will be incorrect.
15
+ if [[ -n $INPUT_PATH ]]; then
16
+ cp -rTfv " $GITHUB_WORKSPACE " / ./
17
+ cd $INPUT_PATH
18
+ else
19
+ # Without a custom path though, we can just grab the .git directory and the PKGBUILD.
20
+ cp -rfv " $GITHUB_WORKSPACE " /.git ./
21
+ cp -fv " $GITHUB_WORKSPACE " /PKGBUILD ./
22
+ fi
14
23
echo " ::endgroup::"
15
24
16
25
# Update archlinux-keyring
@@ -28,7 +37,7 @@ if [[ -n $INPUT_PKGVER ]]; then
28
37
echo " ::endgroup::"
29
38
fi
30
39
31
- # Update pkgver
40
+ # Update pkgrel
32
41
if [[ -n $INPUT_PKGREL ]]; then
33
42
echo " ::group::Updating pkgrel on PKGBUILD"
34
43
sed -i " s:^pkgrel=.*$:pkgrel=$INPUT_PKGREL :g" PKGBUILD
@@ -74,6 +83,8 @@ if [[ -n $INPUT_FLAGS ]]; then
74
83
echo " ::endgroup::"
75
84
fi
76
85
86
+ WORKPATH=$GITHUB_WORKSPACE /$INPUT_PATH
87
+ WORKPATH=${WORKPATH%/ } # Remove trailing slash if $INPUT_PATH is empty
77
88
echo " ::group::Copying files from $HOME /gh-action to $WORKPATH "
78
89
sudo cp -fv PKGBUILD " $WORKPATH " /PKGBUILD
79
90
if [[ -e .SRCINFO ]]; then
0 commit comments