Skip to content

Commit 1ab924c

Browse files
authored
chore: enum updater improvement (#34092)
### Reason for this change The previous exclusion list was applied to parsed sdk enum values. That doesn't work for the wrong mappings between cfn enum values and cdk enum values. This new exclusion list is applied to the cdk enum values directly, means we can exclude any enum values in CDK. ### Description of changes - Instead of applying exclusion list at SDK enum values, this PR moves the exclusion list to CDK enum values. - Make the github workflow run every week automatically. ### Description of how you validated changes Unit tests passed Github workflow run successfully ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent b19eb69 commit 1ab924c

10 files changed

+580
-255
lines changed

.github/workflows/enum-auto-updater.yml

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CDK Enums Auto Updater
22
on:
33
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * 1'
46

57
jobs:
68
update-l2-enums:
@@ -23,6 +25,40 @@ jobs:
2325
- name: Install dependencies
2426
run: cd tools/@aws-cdk/enum-updater && yarn install --frozen-lockfile && yarn build
2527

28+
- name: Update enum static mapping
29+
run: |
30+
cd tools/@aws-cdk/enum-updater
31+
./bin/update-static-enum-mapping
32+
33+
- name: Check for changes
34+
id: static-mapping-check
35+
run: |
36+
if [[ -n "$(git status --porcelain ./lib/static-enum-mapping.json)" ]]; then
37+
echo "changes=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "changes=false" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Create PR for static mapping changes
43+
if: steps.static-mapping-check.outputs.changes == 'true'
44+
run: |
45+
git config --global user.name 'aws-cdk-automation'
46+
git config --global user.email '[email protected]'
47+
48+
# Create a new branch for the module
49+
branchName="enum-update/static-mapping-update"
50+
git checkout -b "$branchName"
51+
52+
git add . # Add all files changed
53+
git commit -m "chore: update enum static mapping"
54+
git push origin "$branchName"
55+
56+
gh pr create --title "chore: update enum static mapping" \
57+
--body "This PR updates the CDK enum mapping file." \
58+
--base main \
59+
--head "$branchName"
60+
--label "contribution/core,pr-linter/exempt-integ-test,pr-linter/exempt-readme,pr-linter/exempt-test"
61+
2662
- name: Identify Missing Values and Apply Code Changes
2763
run: |
2864
cd tools/@aws-cdk/enum-updater
@@ -40,9 +76,6 @@ jobs:
4076
- name: Commit & Push changes
4177
if: steps.git-check.outputs.changes == 'true'
4278
run: |
43-
git config --global user.name 'aws-cdk-automation'
44-
git config --global user.email '[email protected]'
45-
4679
# Iterate through each module directory that has changes
4780
for module in $(git diff --name-only | grep -E '^packages/(@aws-cdk|aws-cdk-lib)/.*' | sed -E 's|^packages/(@aws-cdk\|aws-cdk-lib)/([^/]+).*|\2|' | sort -u); do
4881
moduleName=$(basename $module)

0 commit comments

Comments
 (0)