From 8c09b9fed2eccd4a76db3958fdbecb4859e3bb98 Mon Sep 17 00:00:00 2001 From: denihs Date: Wed, 31 Jul 2024 10:44:59 -0400 Subject: [PATCH] Improve CI script to handle PR branch cloning - Modify the cloning command to check if the build is for a PR - Extract the PR number from the CIRCLE_PULL_REQUEST URL - Fetch the branch associated with the PR using the GitHub API - Clone the repository using the PR branch - Fallback to default behavior for regular branch builds --- .circleci/config.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 61390230e9..24e3f0f4d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -759,7 +759,13 @@ jobs: - run: name: Cloning "meteor" Repository's current branch command: | - git clone --branch $CIRCLE_BRANCH https://github.com/meteor/meteor.git ${CHECKOUT_METEOR_DOCS} + if [[ -n "$CIRCLE_PULL_REQUEST" ]]; then + PR_NUMBER=$(echo $CIRCLE_PULL_REQUEST | sed 's|.*/pull/\([0-9]*\)|\1|') + PR_BRANCH=$(curl -s https://api.github.com/repos/meteor/meteor/pulls/$PR_NUMBER | jq -r .head.ref) + git clone --branch $PR_BRANCH https://github.com/meteor/meteor.git ${CHECKOUT_METEOR_DOCS} + else + git clone --branch $CIRCLE_BRANCH https://github.com/meteor/meteor.git ${CHECKOUT_METEOR_DOCS} + fi # Run almost the same steps the meteor/docs repository runs, minus deploy. - run: name: Generating Meteor documentation for JSDoc testing