From fd2c9017e3d4e9bf175ac749db7898aed85a301c Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Thu, 21 Dec 2023 15:46:54 +0530 Subject: [PATCH] ci: add relevant commits in diff --- ci/tasks/open-charts-pr.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ci/tasks/open-charts-pr.sh b/ci/tasks/open-charts-pr.sh index 4767768f9a2..8c3234065be 100755 --- a/ci/tasks/open-charts-pr.sh +++ b/ci/tasks/open-charts-pr.sh @@ -36,6 +36,18 @@ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git checkout ${ref} app_src_files=($(buck2 uquery 'inputs(deps("//core/..."))' 2>/dev/null)) +relevant_commits=() +for commit in $(git log --format="%H" ${old_ref}..${ref}); do + changed_files=$(git diff-tree --no-commit-id --name-only -r $commit) + + for file in ${changed_files[@]}; do + if [[ " ${app_src_files[*]} " == *"$file"* ]]; then + relevant_commits+=($commit) + break + fi + done +done + # create a branch from the old state and commit the new state of core set +e git fetch origin core-${old_ref} @@ -67,6 +79,17 @@ Code diff contained in this image: ${github_url}/compare/core-${old_ref}...core-${ref} +Relevant commits: +EOF + +for commit in ${relevant_commits[@]}; do + cat <> ../body.md +- ${github_url}/commit/${commit} +EOF +done + +cat <> ../body.md + The galoy api image will be bumped to digest: \`\`\` ${digest}