From e4ac940a7b3317d854da2e53dc53306962c9bb62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Wendt?= Date: Thu, 14 Nov 2024 09:39:55 +0100 Subject: [PATCH] fix: gh cleanup-notifications can be run from any directory Without this, when run outside of the project directory, an error was raised because `index.js` was specified incorrectly: ``` $ gh cleanup-notifications --verbose --dry-run | ts node:internal/modules/cjs/loader:1222 throw err; ^ Error: Cannot find module '/Users/andrewendt/index.js ``` --- gh-cleanup-notifications | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gh-cleanup-notifications b/gh-cleanup-notifications index f09c96a..6402a23 100755 --- a/gh-cleanup-notifications +++ b/gh-cleanup-notifications @@ -7,6 +7,8 @@ if ! type -p node >/dev/null; then exit 1 fi +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" + export GITHUB_TOKEN=$(gh auth token) -exec node index.js "$@" +exec node ${SCRIPT_DIR}/index.js "$@"