Skip to content

Commit a59d579

Browse files
authored
chore(enum-updater): fix indentation (#34303)
### Description of changes fix indentation ### Checklist - [x] 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 aaff1f6 commit a59d579

File tree

1 file changed

+79
-80
lines changed

1 file changed

+79
-80
lines changed

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

Lines changed: 79 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -39,103 +39,102 @@ jobs:
3939
echo "changes=false" >> $GITHUB_OUTPUT
4040
fi
4141
42-
- name: Commit & Push changes
43-
if: steps.git-check.outputs.changes == 'true'
44-
run: |
45-
# Enable command logging
46-
set -x
42+
- name: Commit & Push changes
43+
if: steps.git-check.outputs.changes == 'true'
44+
run: |
45+
# Enable command logging
46+
set -x
4747
48-
echo "=== Starting PR creation process ==="
48+
echo "=== Starting PR creation process ==="
4949

50-
# Iterate through each module directory that has changes
51-
echo "Storing original branch name..."
52-
git config --global user.name 'aws-cdk-automation'
53-
git config --global user.email '[email protected]'
50+
# Iterate through each module directory that has changes
51+
echo "Storing original branch name..."
52+
git config --global user.name 'aws-cdk-automation'
53+
git config --global user.email '[email protected]'
5454

55-
# Store the original branch name
56-
echo "Storing original branch name..."
57-
original_branch=$(git rev-parse --abbrev-ref HEAD)
58-
echo "Original branch: $original_branch"
55+
# Store the original branch name
56+
echo "Storing original branch name..."
57+
original_branch=$(git rev-parse --abbrev-ref HEAD)
58+
echo "Original branch: $original_branch"
5959

60-
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
61-
echo "=== Processing module: $module ==="
62-
moduleName=$(basename $module)
63-
echo "Module name: $moduleName"
60+
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
61+
echo "=== Processing module: $module ==="
62+
moduleName=$(basename $module)
63+
echo "Module name: $moduleName"
6464

65-
# Reset to clean state
66-
echo "Resetting to clean state..."
67-
git reset --hard HEAD
68-
git clean -fd
65+
# Reset to clean state
66+
echo "Resetting to clean state..."
67+
git reset --hard HEAD
68+
git clean -fd
6969

70-
# Determine the correct path for the module
71-
echo "Determining module path..."
72-
if [[ -d "packages/aws-cdk-lib/$module" ]]; then
73-
modulePath="packages/aws-cdk-lib/$module"
74-
echo "Found module in aws-cdk-lib: $modulePath"
75-
elif [[ -d "packages/@aws-cdk/$module" ]]; then
76-
modulePath="packages/@aws-cdk/$module"
77-
echo "Found module in @aws-cdk: $modulePath"
78-
else
79-
echo "ERROR: Cannot find module directory for $module"
80-
continue
81-
fi
70+
# Determine the correct path for the module
71+
echo "Determining module path..."
72+
if [[ -d "packages/aws-cdk-lib/$module" ]]; then
73+
modulePath="packages/aws-cdk-lib/$module"
74+
echo "Found module in aws-cdk-lib: $modulePath"
75+
elif [[ -d "packages/@aws-cdk/$module" ]]; then
76+
modulePath="packages/@aws-cdk/$module"
77+
echo "Found module in @aws-cdk: $modulePath"
78+
else
79+
echo "ERROR: Cannot find module directory for $module"
80+
continue
81+
fi
8282

83-
# Check for existing PR with the same name
84-
prExists=$(gh pr list --state open --search "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" --json number,title -q '.[].number')
83+
# Check for existing PR with the same name
84+
prExists=$(gh pr list --state open --search "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" --json number,title -q '.[].number')
8585

86-
# If a PR exists, close it
87-
if [[ -n "$prExists" ]]; then
88-
echo "Found existing PR #$prExists for module ${moduleName#aws-}, closing it..."
89-
gh pr close "$prExists" --confirm
90-
else
91-
echo "No existing PR found for ${moduleName#aws-}"
92-
fi
86+
# If a PR exists, close it
87+
if [[ -n "$prExists" ]]; then
88+
echo "Found existing PR #$prExists for module ${moduleName#aws-}, closing it..."
89+
gh pr close "$prExists" --confirm
90+
else
91+
echo "No existing PR found for ${moduleName#aws-}"
92+
fi
9393

94-
# Create/switch to branch for the module
95-
branchName="enum-update/${moduleName#aws-}"
96-
echo "Creating/switching to branch: $branchName"
97-
git checkout -B "$branchName" $original_branch # -B forces branch creation/reset
94+
# Create/switch to branch for the module
95+
branchName="enum-update/${moduleName#aws-}"
96+
echo "Creating/switching to branch: $branchName"
97+
git checkout -B "$branchName" $original_branch # -B forces branch creation/reset
9898

99-
# Re-run the update script for this specific module
100-
echo "Re-running update script..."
101-
echo "Current directory: $(pwd)"
102-
cd tools/@aws-cdk/enum-updater
103-
echo "Running update-missing-enums script..."
104-
./bin/update-missing-enums
105-
cd ../../..
106-
echo "Returned to: $(pwd)"
99+
# Re-run the update script for this specific module
100+
echo "Re-running update script..."
101+
echo "Current directory: $(pwd)"
102+
cd tools/@aws-cdk/enum-updater
103+
echo "Running update-missing-enums script..."
104+
./bin/update-missing-enums
105+
cd ../../..
106+
echo "Returned to: $(pwd)"
107107

108-
echo "Checking for changes after update..."
109-
git status
108+
echo "Checking for changes after update..."
109+
git status
110110

111-
# Stage, commit, and push changes for the module
112-
echo "Staging changes for $modulePath"
113-
git add "$modulePath"
111+
# Stage, commit, and push changes for the module
112+
echo "Staging changes for $modulePath"
113+
git add "$modulePath"
114114

115-
echo "Committing changes..."
116-
git commit -m "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}"
115+
echo "Committing changes..."
116+
git commit -m "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}"
117117

118-
# Force push to overwrite any existing branch
119-
echo "Force pushing to remote..."
120-
git push -f origin "$branchName"
121-
118+
# Force push to overwrite any existing branch
119+
echo "Force pushing to remote..."
120+
git push -f origin "$branchName"
122121

123-
# Create a new pull request
124-
echo "Creating pull request..."
125-
gh pr create --title "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" \
126-
--body "This PR updates the enum values for ${moduleName#aws-}." \
127-
--base main \
128-
--head "$branchName" \
129-
--label "contribution/core,pr-linter/exempt-integ-test,pr-linter/exempt-readme,pr-linter/exempt-test"
122+
# Create a new pull request
123+
echo "Creating pull request..."
124+
gh pr create --title "chore(${moduleName#aws-}): add new enum values for ${moduleName#aws-}" \
125+
--body "This PR updates the enum values for ${moduleName#aws-}." \
126+
--base main \
127+
--head "$branchName" \
128+
--label "contribution/core,pr-linter/exempt-integ-test,pr-linter/exempt-readme,pr-linter/exempt-test"
130129

131-
# Return to original branch
132-
echo "Returning to original branch: $original_branch"
133-
git checkout $original_branch
130+
# Return to original branch
131+
echo "Returning to original branch: $original_branch"
132+
git checkout $original_branch
134133

135-
echo "=== Completed processing for module: $module ==="
136-
done
134+
echo "=== Completed processing for module: $module ==="
135+
done
137136

138-
# Disable command logging
139-
set +x
137+
# Disable command logging
138+
set +x
140139
env:
141140
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)