Skip to content

Commit ecd46f1

Browse files
committed
fix: update CI/CD workflows to ensure proper execution conditions for Docker and Trivy scan
1 parent 874aa35 commit ecd46f1

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/ci-cd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
uses: ./.github/workflows/pytest.yaml
2121

2222
docker:
23+
if: github.event_name == 'push'
2324
needs: test
2425
uses: ./.github/workflows/docker-build-and-scan.yaml
2526
with:

.github/workflows/docker-build-and-scan.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
push: ${{ inputs.DOCKER_PUSH_BOOL }}
4646
tags: ${{ inputs.DOCKER_TAGS }}
4747
- name: Run Trivy vulnerability scanner (remote)
48+
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
4849
uses: aquasecurity/trivy-action@0.33.1
4950
with:
5051
image-ref: docker.io/${{ inputs.DOCKER_TAGS }}

src/sample_python_app/core/data_loader.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ def fetch_astronomical_data_from_api(lat: float, lon: float):
2525
logger = setup_logger(mode="silent")
2626
url = f"https://api.weather.gov/points/{lat},{lon}"
2727
headers = {"User-Agent": "(myweatherapp.com, contact@myweatherapp.com)"}
28+
logger.info(f"Fetching astronomical data from URL: {url}")
29+
logger.info(f"Request headers: {headers}")
2830
try:
2931
response = httpx.get(url, headers=headers)
3032
response.raise_for_status()

0 commit comments

Comments
 (0)