Skip to content

Commit

Permalink
Update Earthfile
Browse files Browse the repository at this point in the history
  • Loading branch information
minikin committed Oct 24, 2024
1 parent a09ca82 commit 46a289d
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions utilities/project-fields-validator/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,27 @@ IMPORT github.com/input-output-hk/catalyst-ci/earthly/python:v3.1.7 AS python-ci

test:
FROM python-ci+python-base

COPY . .

DO python-ci+CHECK

validate-pr:
FROM python-ci+python-base

COPY . .

RUN pip install requests
RUN pip install requests jq

ENV PROJECT_NUMBER=102
ARG GITHUB_TOKEN
ARG GITHUB_REPOSITORY
ARG GITHUB_EVENT_NUMBER

RUN --secret GITHUB_TOKEN python3 main.py
# Extract PR info from GitHub event context
RUN --secret GITHUB_TOKEN \
if [ -f "$GITHUB_EVENT_PATH" ]; then \
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH"); \
REPO=$(jq --raw-output .repository.full_name "$GITHUB_EVENT_PATH"); \
export GITHUB_EVENT_NUMBER=$PR_NUMBER; \
export GITHUB_REPOSITORY=$REPO; \
fi && \
python3 main.py

VALIDATE_PROJECT_FIELDS:
FUNCTION

ARG GITHUB_REPOSITORY
ARG GITHUB_EVENT_NUMBER

FROM +validate-pr
DO +validate-pr

0 comments on commit 46a289d

Please sign in to comment.