Skip to content

Commit

Permalink
ci: add relevant commits in diff
Browse files Browse the repository at this point in the history
  • Loading branch information
krtk6160 committed Dec 21, 2023
1 parent 9ed020c commit 696d465
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions ci/apps/tasks/open-charts-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git checkout ${ref}
app_src_files=($(buck2 uquery 'inputs(deps("'"//apps/${APP}:"'"))' 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 the app
set +e
git fetch origin ${APP}-${old_ref}
Expand Down Expand Up @@ -66,6 +78,17 @@ Code diff contained in this image:
${github_url}/compare/${APP}-${old_ref}...${APP}-${ref}
Relevant commits:
EOF

for commit in ${relevant_commits[@]}; do
cat <<EOF >> ../body.md
- ${github_url}/commit/${commit}
EOF
done

cat <<EOF >> ../body.md
The ${APP} image will be bumped to digest:
\`\`\`
${digest}
Expand Down

0 comments on commit 696d465

Please sign in to comment.