Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CI): Add new comment to smithy diff checker gha #670

Merged
merged 7 commits into from
Jul 30, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/smithy-diff.yml
Original file line number Diff line number Diff line change
@@ -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/mainline 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\"}"
Loading