This is a test #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: API Changelog Check | |
| on: | |
| pull_request: | |
| paths: | |
| - 'codegen/aws-models/**' | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-changelog: | |
| runs-on: ubuntu-latest | |
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-changelog') }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed model files | |
| id: changed-models | |
| run: | | |
| changed_models=$(git diff --name-only origin/${{ github.base_ref }}...HEAD -- 'codegen/aws-models/*.json' | xargs -I {} basename {} .json) | |
| echo "models<<EOF" >> $GITHUB_OUTPUT | |
| echo "$changed_models" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Check for changelog entries | |
| run: | | |
| missing_changelogs="" | |
| while IFS= read -r service; do | |
| [ -z "$service" ] && continue | |
| changelog_dir="clients/aws-sdk-${service}/.changes/next-release" | |
| if [ ! -d "$changelog_dir" ]; then | |
| missing_changelogs="${missing_changelogs}\n - ${service} (directory does not exist: ${changelog_dir})" | |
| continue | |
| fi | |
| # Check if there are any files in the next-release directory | |
| file_count=$(find "$changelog_dir" -maxdepth 1 -type f | wc -l) | |
| if [ "$file_count" -eq 0 ]; then | |
| missing_changelogs="${missing_changelogs}\n - ${service} (no changelog entries in ${changelog_dir})" | |
| fi | |
| done <<< "${{ steps.changed-models.outputs.models }}" | |
| if [ -n "$missing_changelogs" ]; then | |
| echo "::error::Missing changelog entries for the following services:${missing_changelogs}" | |
| echo "" | |
| echo "Please add a changelog entry in clients/aws-sdk-<service>/.changes/next-release/ for each modified model." | |
| exit 1 | |
| fi | |
| echo "All modified models have corresponding changelog entries." |