Skip to content

Commit bb399bf

Browse files
authored
chore(CI): make smithy fidd check smarter (#1381)
1 parent 36f48b0 commit bb399bf

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/smithy-diff.yml

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
name: Check Smithy Files
44

55
on:
6-
pull_request:
6+
pull_request_review:
7+
types: [submitted]
78

89
jobs:
910
require-approvals:
@@ -19,20 +20,22 @@ jobs:
1920
- name: Get Files changed
2021
id: file-changes
2122
shell: bash
23+
env:
24+
GITHUB_HEAD: ${{github.event.pull_request.head.ref}}
2225
run:
2326
# Checks to see if any of the smithy Models are being updated.
2427
# Doing this check allows us to catch things like, missing @javadoc trait documentation or bug in smithy dafny that has not be resolved.
25-
echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} | grep '\.smithy$' | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
28+
echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD} | grep '\.smithy$' | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
2629

2730
- name: Check if FILES is not empty
2831
id: comment
2932
env:
30-
PR_NUMBER: ${{ github.event.number }}
33+
PR_NUMBER: ${{ github.event.pull_request.number }}
3134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3235
FILES: ${{ steps.file-changes.outputs.FILES }}
3336
if: ${{env.FILES != ''}}
3437
run: |
3538
# TODO: If https://github.com/smithy-lang/smithy-dafny/issues/491 is resolved, remove comment about this issue.
36-
COMMENT="@${{github.actor}}, I noticed you are updating the smithy model files.\nDoes this update need new or updated javadoc trait documentation?\n Are you adding constraints inside list, map or union? Do you know about this issue: https://github.com/smithy-lang/smithy-dafny/issues/491?"
39+
COMMENT="@${{github.event.pull_request.user.login}} and @${{github.actor}}, I noticed you are updating the smithy model files.\nDoes this update need new or updated javadoc trait documentation?\n Are you adding constraints inside list, map or union? Do you know about this issue: https://github.com/smithy-lang/smithy-dafny/issues/491?"
3740
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
3841
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"

0 commit comments

Comments
 (0)