Skip to content

Commit 86406f5

Browse files
chore(CI): add smithy diff checker GHA (#1226)
1 parent 23c8a18 commit 86406f5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/smithy-diff.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 smithy Models are being updated.
24+
# 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"
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+
# 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?"
37+
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
38+
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"

0 commit comments

Comments
 (0)