From a907fe1133583089a76f312325ce4efa5ae5ba24 Mon Sep 17 00:00:00 2001 From: Wojtek Zieba Date: Mon, 16 Sep 2024 12:18:16 +0200 Subject: [PATCH] Don't require providing owner and repo names Instead, get this from BUILDKITE env variable. I took this idea from comment_on_pr script. --- bin/comment_with_dependency_diff | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/comment_with_dependency_diff b/bin/comment_with_dependency_diff index 5f1be45..56ebf30 100755 --- a/bin/comment_with_dependency_diff +++ b/bin/comment_with_dependency_diff @@ -4,14 +4,15 @@ set -euo pipefail MODULE="${1:-}" CONFIGURATION="${2:-}" -OWNER="${3:-}" -REPO="${4:-}" -if [ -z "$MODULE" ] || [ -z "$CONFIGURATION" ] || [ -z "$OWNER" ] || [ -z "$REPO" ]; then - echo "Not enough arguments provided. Usage: ./comment_with_dependency_diff " +if [ -z "$MODULE" ] || [ -z "$CONFIGURATION" ]; then + echo "Not enough arguments provided. Usage: ./comment_with_dependency_diff " exit 1 fi +OWNER=$(basename "$(dirname "${BUILDKITE_PULL_REQUEST_REPO}")") +REPO=$(basename "${BUILDKITE_PULL_REQUEST_REPO%.git}") + DIFF_DEPENDENCIES_FOLDER="./build/reports/diff" BASE_BRANCH_DEPENDENCIES_FILE="$DIFF_DEPENDENCIES_FOLDER/base_branch_dependencies.txt" HEAD_BRANCH_DEPENDENCIES_FILE="$DIFF_DEPENDENCIES_FOLDER/head_branch_dependencies.txt"