diff --git a/utilities/project-fields-validator/Earthfile b/utilities/project-fields-validator/Earthfile index ba87ab5d..f3ba51e4 100644 --- a/utilities/project-fields-validator/Earthfile +++ b/utilities/project-fields-validator/Earthfile @@ -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 \ No newline at end of file + DO +validate-pr \ No newline at end of file