chore: add workflow to check if change file is included in a PR #459
Workflow file for this run
This file contains 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: Detect CDK Bootstrap Version Changes | |
on: [pull_request] | |
jobs: | |
detect-cdk-bootstrap-changes: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
- name: Install AWS CDK | |
run: | | |
npm install -g aws-cdk | |
- name: Get Staging Bucket Update/Replace Policy | |
id: stagingBucketUpdateReplacePolicy | |
run: | | |
echo "update-replace-policy=$(yq '.Resources.StagingBucket.UpdateReplacePolicy' 'src/AWS.Deploy.Orchestration/CDK/CDKBootstrapTemplate.yaml')" >> $GITHUB_OUTPUT | |
- name: Get Staging Bucket Deletion Policy | |
id: stagingBucketDeletionPolicy | |
run: | | |
echo "deletion-policy=$(yq '.Resources.StagingBucket.DeletionPolicy' 'src/AWS.Deploy.Orchestration/CDK/CDKBootstrapTemplate.yaml')" >> $GITHUB_OUTPUT | |
- name: Fail If Update/Replace Policy Not 'Delete' | |
if: steps.stagingBucketUpdateReplacePolicy.outputs.update-replace-policy != 'Delete' | |
run: | | |
echo "The 'UpdateReplacePolicy' of the 'StaginBucket' in the CDK bootstrap template should be 'Delete'." | |
exit 1 | |
- name: Fail If Deletion Policy Not 'Delete' | |
if: steps.stagingBucketDeletionPolicy.outputs.deletion-policy != 'Delete' | |
run: | | |
echo "The 'DeletionPolicy' of the 'StaginBucket' in the CDK bootstrap template should be 'Delete'." | |
exit 1 | |
- name: Save New CDK Bootstrap Template | |
run: | | |
cdk bootstrap --show-template > newTemplate.yml | |
- name: Get Latest CDK Bootstrap Version | |
id: latestBootstrapVersion | |
run: | | |
echo "latest-version=$(yq '.Resources.CdkBootstrapVersion.Properties.Value' 'newTemplate.yml')" >> $GITHUB_OUTPUT | |
- name: Get Current CDK Bootstrap Version | |
id: currentBootstrapVersion | |
run: | | |
echo "current-version=$(yq '.Resources.CdkBootstrapVersion.Properties.Value' 'src/AWS.Deploy.Orchestration/CDK/CDKBootstrapTemplate.yaml')" >> $GITHUB_OUTPUT | |
- name: Fail If CDK Bootstrap Template Changes Detected | |
if: steps.currentBootstrapVersion.outputs.current-version != steps.latestBootstrapVersion.outputs.latest-version | |
run: | | |
echo "A new version of the AWS CDK Bootstrap Template is available. The current template that is being used by the Deploy tool needs to be updated." | |
exit 1 |