Skip to content

Commit 4d61abf

Browse files
committed
check_email_pr: Use paths relative to script
Don't assume the current dir is the root of this repo. Signed-off-by: Nasser Grainawi <nasser.grainawi@oss.qualcomm.com>
1 parent e07d4ce commit 4d61abf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

check_email_pr.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,18 @@
22
# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
33
# SPDX-License-Identifier: BSD-3-Clause
44

5+
readlink -f / &> /dev/null || readlink() { greadlink "$@" ; } # for MacOS
6+
MYPROG=$(readlink -f -- "$0")
7+
MYDIR=$(dirname -- "$MYPROG")
8+
59
debug() { echo "::debug::$1" >&2 ; } # message
610
error() { echo "::error::$1" >&2 ; } # message
711

812
# https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-commits-on-a-pull-request
913
get_pr_commits() {
1014
if [ -n "$TEST_MODE" ] ; then
1115
debug "Using list_commits test data"
12-
cat ./test/pr_list_commits.json
16+
cat "$MYDIR"/test/pr_list_commits.json
1317
return
1418
fi
1519
[ "$COMMITS_COUNT" -gt 100 ] && debug "Needs pagination"
@@ -54,7 +58,7 @@ done
5458
RESULT=0
5559
while read -r pr_commit ; do
5660
debug "Running check on: $pr_commit"
57-
./src/check_email.sh --json "$pr_commit" "${TEST_MODE[@]}" || RESULT=1
61+
"$MYDIR"/src/check_email.sh --json "$pr_commit" "${TEST_MODE[@]}" || RESULT=1
5862
done < <(get_pr_commits | split_commits_and_add_metadata)
5963

6064
exit $RESULT

0 commit comments

Comments
 (0)