Skip to content

[WIP] feat: Rplt 728 cdk output review #7

[WIP] feat: Rplt 728 cdk output review

[WIP] feat: Rplt 728 cdk output review #7

Workflow file for this run

name: CDK Synth
on:
pull_request:
types: ['opened', 'synchronize']
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}
AWS_REGION: ${{secrets.AWS_REGION}}
CI: true
jobs:
check-synth:
name: CDK Synth
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Node
uses: actions/setup-node@v3
with:
node-version: '18.x'
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35
with:
dir_names: true
dir_names_max_depth: 2
json: true
quotepath: false
- name: Install
run: yarn
- name: Fetch config
run: |
yarn workspaces foreach --parallel --verbose --since --recursive run conf --name development
- name: Filter files in packages
id: filter-packages
run: |
FILTERED_FOLDERS=$(echo "${{ steps.changed-files.outputs.all_changed_files }}" | jq -r 'map(select(test("^packages/"))) | map(sub("^packages/"; "")) | unique | join(" ")')
echo "Changed folders: $FILTERED_FOLDERS"
echo "CHANGED_FOLDERS=$FILTERED_FOLDERS" >> $GITHUB_ENV
- name: Build
run: |
for package in $CHANGED_FOLDERS; do
yarn workspace $package run build;
done
- name: CDK diff
run: |
OUTPUT=()
for package in $CHANGED_FOLDERS; do
echo "package: $package"
jq -e ".scripts.cdk-diff != null" "packages/$package/package.json"
if jq -e '.scripts.cdk-diff != null' "packages/$package/package.json" > /dev/null 2>&1; then
echo "starting: $package"
yarn workspace $package cdk-diff --output packages/$package/cdk.synth
OUTPUT+=$(yarn workspace $package cdk-diff --output packages/$package/cdk.synth)
fi
done
echo "output: $OUTPUT"
echo "CDK_DIFF=$OUTPUT" >> $GITHUB_ENV
- name: diff
run: |
git diff
# - name: comment
# uses: actions/github-script@v3
# with:
# github-token: ${{secrets.GITHUB_TOKEN}}
# script: |
# const diff = process.env.DIFF;
# github.issues.createComment({
# issue_number: context.issue.number,
# owner: context.repo.owner,
# repo: context.repo.repo,
# body: 'Synth changes have been committed \n\n' + '```' + diff + '```',
# })
# - name: commit
# uses: stefanzweifel/git-auto-commit-action@v4
# with:
# commit_message: 'chore: synth updates'