From e8234e5e12ddb2ac7d9c72057d364272f587f76b Mon Sep 17 00:00:00 2001 From: Vijaya Krishna Manne Date: Fri, 29 May 2026 14:12:15 -0400 Subject: [PATCH] Add Forgejo self-clone fallback for workflow source --- .forgejo/workflows/deploy-cfn.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/deploy-cfn.yml b/.forgejo/workflows/deploy-cfn.yml index 501020e..72ada9a 100644 --- a/.forgejo/workflows/deploy-cfn.yml +++ b/.forgejo/workflows/deploy-cfn.yml @@ -15,14 +15,18 @@ jobs: AWS_DEFAULT_REGION: ${{ secrets.LOWER }} steps: - - name: Verify workspace + - name: Prepare source run: | - pwd - ls -la + set -e + SRC_DIR="." if [ ! -f "infra/hello-lambda.yml" ]; then - echo "infra/hello-lambda.yml not found in runner workspace" - exit 1 + echo "Repository files not present in workspace. Cloning from Forgejo..." + git clone --depth 1 "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" _src + SRC_DIR="_src" fi + [ -f "${SRC_DIR}/infra/hello-lambda.yml" ] || { echo "infra/hello-lambda.yml not found"; exit 1; } + echo "SRC_DIR=${SRC_DIR}" >> "$GITHUB_ENV" + echo "Using source directory: ${SRC_DIR}" - name: Ensure AWS CLI run: | @@ -54,11 +58,11 @@ jobs: - name: Validate CFT run: | aws cloudformation validate-template \ - --template-body file://infra/hello-lambda.yml + --template-body "file://${SRC_DIR}/infra/hello-lambda.yml" - name: Deploy CFT run: | aws cloudformation deploy \ --stack-name hello-lambda-stack \ - --template-file infra/hello-lambda.yml \ + --template-file "${SRC_DIR}/infra/hello-lambda.yml" \ --capabilities CAPABILITY_NAMED_IAM