Skip to content

Commit

Permalink
Merge pull request #25 from aws-educate-tw/SCRUM-52-Shiun-Terraform-m…
Browse files Browse the repository at this point in the history
…odule-

fix(actions): fixed if...else syntax error (SCRUM-52)
  • Loading branch information
sh1un committed Jul 7, 2024
2 parents 9101b42 + f8a3aef commit 51fc2ca
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
1 change: 1 addition & 0 deletions .github/workflows/email_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ jobs:
else
echo "Unsupported branch: ${{ github.ref }}"
exit 1
fi
- name: Terraform Init
id: init
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/file_service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@ permissions:
contents: write
issues: write
pull-requests: write
actions: read
checks: write

jobs:
preview:
name: "Deploy Preview Environment"
if: github.event_name == 'pull_request' && github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: "Print Debug Information"
run: |
echo "Event Name: ${{ github.event_name }}"
echo "Event Action: ${{ github.event.action }}"
echo "Merged: ${{ github.event.pull_request.merged }}"
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.3
Expand Down Expand Up @@ -105,11 +111,15 @@ jobs:
cleanup_preview:
name: "Cleanup Preview Environment"
if: github.event_name == 'pull_request' && github.event.action == 'closed'
if: github.event_name == 'pull_request' && github.event.action == 'closed' || github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: "Print Debug Information"
run: |
echo "Event Name: ${{ github.event_name }}"
echo "Event Action: ${{ github.event.action }}"
echo "Merged: ${{ github.event.pull_request.merged }}"
- uses: actions/checkout@v3

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.3
Expand All @@ -124,12 +134,16 @@ jobs:

deploy:
name: "Deploy to Target Environment"
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true)
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
runs-on: ubuntu-latest
needs: [cleanup_preview]
steps:
- name: "Print Debug Information"
run: |
echo "Event Name: ${{ github.event_name }}"
echo "Event Action: ${{ github.event.action }}"
echo "Merged: ${{ github.event.pull_request.merged }}"
- uses: actions/checkout@v3

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: 1.8.3
Expand Down
2 changes: 1 addition & 1 deletion src/email_service/send_email/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_file_info(file_id):
api_url = f"{FILE_SERVICE_API_BASE_URL}/files/{file_id}"
response = requests.get(api_url)
response.raise_for_status()
print("test3")
print("test4")
return response.json()
except RequestException as e:
logger.error("Error in get_file_info: %s", e)
Expand Down
2 changes: 1 addition & 1 deletion src/file_service/get_file/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def default(self, o):

def lambda_handler(event, context):
file_id = event["pathParameters"]["file_id"]

print("test")
response = table.get_item(Key={"file_id": file_id})

if "Item" not in response:
Expand Down

0 comments on commit 51fc2ca

Please sign in to comment.