Skip to content

Commit e8a9f25

Browse files
chore(CI): add smithy diff checker gha
1 parent c817b5b commit e8a9f25

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/smithy-diff.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This workflow checks if specfic files were modified,
2+
# if they were they require more than one approval from CODEOWNERS
3+
name: Check Smithy Files
4+
5+
on:
6+
pull_request:
7+
8+
jobs:
9+
require-approvals:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Get Files changed
20+
id: file-changes
21+
shell: bash
22+
run:
23+
# Checks to see if any of the customer facing Models are being updated.
24+
# Doing this check allows us to catch things like, missing @javadoc trait documentation.
25+
echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} AwsCryptographicMaterialProviders/dafny/**/Model/*.smithy | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
26+
27+
- name: Check if FILES is not empty
28+
id: comment
29+
env:
30+
PR_NUMBER: ${{ github.event.number }}
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
FILES: ${{ steps.file-changes.outputs.FILES }}
33+
if: ${{env.FILES != ''}}
34+
run: |
35+
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?"
36+
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
37+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"

0 commit comments

Comments
 (0)