Skip to content

Commit 0865abb

Browse files
committed
Update merge verified to always include target and source sha in output
1 parent 75d048d commit 0865abb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/actions/merge-branches-verified/merge-branches-verified.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ FROM_SHA=$last_cmd_stdout
5252
execute_command --no-std -- git rev-parse "origin/$TO_BRANCH"
5353
TO_SHA=$last_cmd_stdout
5454

55+
if [ -n "$GITHUB_OUTPUT" ]; then
56+
echo "target_before_merge_sha=$TO_SHA" >> "$GITHUB_OUTPUT"
57+
echo "source_commit_sha=$FROM_SHA" >> "$GITHUB_OUTPUT"
58+
fi
59+
5560
# Check if FROM_BRANCH is already merged into TO_BRANCH
5661
execute_command --ignore-exit-code 1 --no-std -- git merge-base --is-ancestor "origin/$FROM_BRANCH" "origin/$TO_BRANCH"
5762
if [ $last_cmd_result -eq 0 ]; then
@@ -70,6 +75,4 @@ if [ -n "$GITHUB_OUTPUT" ]; then
7075
if echo "$merge_commit_sha" | grep -Pq '^[0-9a-fA-F]{40,}\s*$'; then
7176
echo "merge_commit_sha=$merge_commit_sha" >> "$GITHUB_OUTPUT"
7277
fi
73-
echo "target_before_merge_sha=$TO_SHA" >> "$GITHUB_OUTPUT"
74-
echo "source_commit_sha=$FROM_SHA" >> "$GITHUB_OUTPUT"
7578
fi

0 commit comments

Comments
 (0)