Skip to content

Commit 5e0ad9f

Browse files
author
David Elner
committed
Fixed: Interpolation and ref checking
1 parent 8c98f05 commit 5e0ad9f

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ jobs:
5757
VERSION=$(ruby -r "./lib/braintrust/version.rb" -e "puts Braintrust::VERSION")
5858
echo "version=$VERSION" >> $GITHUB_OUTPUT
5959
60+
- name: Validate SHA format
61+
run: |
62+
if ! echo "${{ inputs.sha }}" | grep -qE '^[0-9a-f]{40}$'; then
63+
echo "Error: sha must be a full 40-character commit SHA — branch names and short SHAs are not accepted."
64+
exit 1
65+
fi
66+
6067
- name: Validate release
6168
id: validate-release
6269
run: |
@@ -136,6 +143,7 @@ jobs:
136143
- name: Post release summary
137144
env:
138145
TAG: ${{ needs.validate.outputs.release_tag }}
146+
COMMIT_MSG: ${{ needs.validate.outputs.commit_message }}
139147
run: |
140148
NOTES=$(echo "${{ needs.prepare.outputs.notes }}" | base64 -d 2>/dev/null)
141149
if [ -z "$NOTES" ]; then NOTES="_Release notes unavailable._"; fi
@@ -161,7 +169,7 @@ jobs:
161169
fi
162170
163171
echo "**SHA:** [${{ inputs.sha }}]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/${{ inputs.sha }})" >> $GITHUB_STEP_SUMMARY
164-
echo "**Commit:** ${{ needs.validate.outputs.commit_message }}" >> $GITHUB_STEP_SUMMARY
172+
echo "**Commit:** $COMMIT_MSG" >> $GITHUB_STEP_SUMMARY
165173
echo "**Branch:** $BRANCH_LABEL" >> $GITHUB_STEP_SUMMARY
166174
167175
PREV_TAG="${{ needs.validate.outputs.prev_tag }}"
@@ -178,6 +186,7 @@ jobs:
178186
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
179187
SLACK_CHANNEL: ${{ vars.SLACK_SDK_RELEASE_CHANNEL }}
180188
TAG: ${{ needs.validate.outputs.release_tag }}
189+
PR_LIST_RAW: ${{ needs.prepare.outputs.pr_list }}
181190
run: |
182191
APPROVE_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
183192
@@ -196,7 +205,7 @@ jobs:
196205
DIFF_PART=" · <$DIFF_URL|${PREV_TAG}...$TAG>"
197206
fi
198207
199-
PR_LIST=$(echo "${{ needs.prepare.outputs.pr_list }}" | tr $'\x1f' '\n' | sed '/^$/d')
208+
PR_LIST=$(echo "$PR_LIST_RAW" | tr $'\x1f' '\n' | sed '/^$/d')
200209
201210
TEXT=":ruby: *braintrust-sdk-ruby $TAG* awaiting approval"
202211
@@ -283,6 +292,7 @@ jobs:
283292
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
284293
SLACK_CHANNEL: ${{ vars.SLACK_SDK_RELEASE_CHANNEL }}
285294
TAG: ${{ needs.validate.outputs.release_tag }}
295+
PR_LIST_RAW: ${{ needs.prepare.outputs.pr_list }}
286296
run: |
287297
RELEASE_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$TAG"
288298
@@ -293,7 +303,7 @@ jobs:
293303
DIFF_PART="<$DIFF_URL|${PREV_TAG}...$TAG> · "
294304
fi
295305
296-
PR_LIST=$(echo "${{ needs.prepare.outputs.pr_list }}" | tr $'\x1f' '\n' | sed '/^$/d')
306+
PR_LIST=$(echo "$PR_LIST_RAW" | tr $'\x1f' '\n' | sed '/^$/d')
297307
298308
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
299309

0 commit comments

Comments
 (0)