From 32e0d5a6b5066c469df2cb4a022d59d64cec5241 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 25 Jul 2024 13:30:38 -0700 Subject: [PATCH 1/7] chore(CI): Add new comment to smithy diff checker gha --- .github/workflows/smithy-diff.yml | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/smithy-diff.yml diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml new file mode 100644 index 000000000..f6612a091 --- /dev/null +++ b/.github/workflows/smithy-diff.yml @@ -0,0 +1,37 @@ +# This workflow checks if specfic files were modified, +# if they were they require more than one approval from CODEOWNERS +name: Check Smithy Files + +on: + pull_request: + +jobs: + require-approvals: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get Files changed + id: file-changes + shell: bash + run: + # Checks to see if any of the customer facing Models are being updated. + # Doing this check allows us to catch things like, missing @javadoc trait documentation. + echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} AwsEncryptionSDK/dafny/**/Model/*.smithy | tr '\n' ' ')" >> "$GITHUB_OUTPUT" + + - name: Check if FILES is not empty + id: comment + env: + PR_NUMBER: ${{ github.event.number }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FILES: ${{ steps.file-changes.outputs.FILES }} + if: ${{env.FILES != ''}} + run: | + 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?" + COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" + curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}" \ No newline at end of file From dac0c57c5a376c0a49a7c4396fa60748500695ce Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 25 Jul 2024 13:32:58 -0700 Subject: [PATCH 2/7] Test by changing smithy file --- AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy b/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy index ba12c4325..96b3b9235 100644 --- a/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy +++ b/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy @@ -8,7 +8,7 @@ use aws.cryptography.materialProviders#AwsCryptographicMaterialProviders // TODO add a trait to indicate that 'Client' should not be appended to this name, // and that the code gen should expose operations under this service statically if -// possible in the target language +// possible in the target languag @aws.polymorph#localService( sdkId: "ESDK", config: AwsEncryptionSdkConfig, From 1f3006ebaab8fda71be0ede8965416bc8e8fe4d2 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 25 Jul 2024 13:35:03 -0700 Subject: [PATCH 3/7] Fix origin mainline --- .github/workflows/smithy-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml index f6612a091..e5827f709 100644 --- a/.github/workflows/smithy-diff.yml +++ b/.github/workflows/smithy-diff.yml @@ -22,7 +22,7 @@ jobs: run: # Checks to see if any of the customer facing Models are being updated. # Doing this check allows us to catch things like, missing @javadoc trait documentation. - echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} AwsEncryptionSDK/dafny/**/Model/*.smithy | tr '\n' ' ')" >> "$GITHUB_OUTPUT" + echo "FILES=$(git diff --name-only origin/mainline origin/${GITHUB_HEAD_REF} AwsEncryptionSDK/dafny/**/Model/*.smithy | tr '\n' ' ')" >> "$GITHUB_OUTPUT" - name: Check if FILES is not empty id: comment From 3007755dc9e376fdd791027f6579c4452a547dd9 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 25 Jul 2024 13:38:31 -0700 Subject: [PATCH 4/7] Revert "Test by changing smithy file" This reverts commit dac0c57c5a376c0a49a7c4396fa60748500695ce. --- AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy b/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy index 96b3b9235..ba12c4325 100644 --- a/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy +++ b/AwsEncryptionSDK/dafny/AwsEncryptionSdk/Model/esdk.smithy @@ -8,7 +8,7 @@ use aws.cryptography.materialProviders#AwsCryptographicMaterialProviders // TODO add a trait to indicate that 'Client' should not be appended to this name, // and that the code gen should expose operations under this service statically if -// possible in the target languag +// possible in the target language @aws.polymorph#localService( sdkId: "ESDK", config: AwsEncryptionSdkConfig, From cc9c625ef08fb2638a90f04100d4eb388cd56952 Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Thu, 25 Jul 2024 13:46:28 -0700 Subject: [PATCH 5/7] Format --- .github/workflows/smithy-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml index e5827f709..170d5ed70 100644 --- a/.github/workflows/smithy-diff.yml +++ b/.github/workflows/smithy-diff.yml @@ -34,4 +34,4 @@ jobs: run: | 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?" COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" - curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}" \ No newline at end of file + curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}" From b8f0adab324984d6e5d2581f61abee332f1ccecd Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Mon, 29 Jul 2024 17:26:25 -0700 Subject: [PATCH 6/7] Update like in mpl --- .github/workflows/smithy-diff.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml index 170d5ed70..a666e78cc 100644 --- a/.github/workflows/smithy-diff.yml +++ b/.github/workflows/smithy-diff.yml @@ -21,8 +21,8 @@ jobs: shell: bash run: # Checks to see if any of the customer facing Models are being updated. - # Doing this check allows us to catch things like, missing @javadoc trait documentation. - echo "FILES=$(git diff --name-only origin/mainline origin/${GITHUB_HEAD_REF} AwsEncryptionSDK/dafny/**/Model/*.smithy | tr '\n' ' ')" >> "$GITHUB_OUTPUT" + # Doing this check allows us to catch things like, missing @javadoc trait documentation or bug in smithy dafny that has not be resolved. + echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} | grep '\.smithy$' | tr '\n' ' ')" >> "$GITHUB_OUTPUT" - name: Check if FILES is not empty id: comment @@ -32,6 +32,7 @@ jobs: FILES: ${{ steps.file-changes.outputs.FILES }} if: ${{env.FILES != ''}} run: | + # TODO: If https://github.com/smithy-lang/smithy-dafny/issues/491 is resolved, remove comment about this issue. 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?" COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments" curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}" From 4a1e8bb6a34a9fc19ce2fd8cd06148098b4ffd2d Mon Sep 17 00:00:00 2001 From: rishav-karanjit Date: Tue, 30 Jul 2024 09:03:13 -0700 Subject: [PATCH 7/7] Update comment --- .github/workflows/smithy-diff.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/smithy-diff.yml b/.github/workflows/smithy-diff.yml index a666e78cc..b874861c1 100644 --- a/.github/workflows/smithy-diff.yml +++ b/.github/workflows/smithy-diff.yml @@ -20,7 +20,7 @@ jobs: id: file-changes shell: bash run: - # Checks to see if any of the customer facing Models are being updated. + # Checks to see if any of the smithy Models are being updated. # Doing this check allows us to catch things like, missing @javadoc trait documentation or bug in smithy dafny that has not be resolved. echo "FILES=$(git diff --name-only origin/main origin/${GITHUB_HEAD_REF} | grep '\.smithy$' | tr '\n' ' ')" >> "$GITHUB_OUTPUT"