Skip to content

EREGCSC-3014 Run CDK garbage collection weekly #4

EREGCSC-3014 Run CDK garbage collection weekly

EREGCSC-3014 Run CDK garbage collection weekly #4

name: Collect Garbage
on:
pull_request:
types: [opened, synchronize, reopened]
#workflow_dispatch:
#schedule:
# - cron: "0 0 * * 0" # weekly
permissions:
id-token: write
contents: read
actions: read
pull-requests: write
jobs:
collect-garbage:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
#environment: ["dev", "val", "prod"]
environment: ["dev"]
app: ["docker-lambdas", "static-assets", "text-extractor", "zip-lambdas"]
environment:
name: ${{ matrix.environment }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ vars.AWS_DEFAULT_REGION }}
- name: Run garbage collection
env:
ENVIRONMENT: ${{ matrix.environment }}
APP: ${{ matrix.app }}
run: |
pushd cdk-eregs
npm install
npm install fs-extra
npm install --save-dev @types/fs-extra
npx cdk gc \
--unstable=gc \
--context environment=$ENVIRONMENT \
--type all \
--confirm false \
--app "npx ts-node bin/${APP}.ts"