From 469b84ab5ea86da5998a713bfc353436703c5f36 Mon Sep 17 00:00:00 2001 From: Captain Throwback Date: Tue, 5 Mar 2024 11:13:29 -0500 Subject: [PATCH] Create remote from device tree URL Allows non-Github links to be used properly --- .github/workflows/Recovery Build.yml | 12 +++++++++--- templates/roomservice.xml | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Recovery Build.yml b/.github/workflows/Recovery Build.yml index 0a8ebbf94..1d61300d4 100644 --- a/.github/workflows/Recovery Build.yml +++ b/.github/workflows/Recovery Build.yml @@ -143,14 +143,20 @@ jobs: repo sync -j$(nproc --all) working-directory: workspace - - name: Clone device tree (Github) + - name: Clone device tree (Github/Other) if: | !contains( inputs.DEVICE_TREE_URL,'/TeamWin/' ) && steps.buildtree.outputs.value == 'aosp' run: | - sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP '(?<=github.com/).*' <<< ${{ inputs.DEVICE_TREE_URL }})%g" .repo/local_manifests/roomservice.xml + REMOTE_NAME=$(grep -oP '(?<=://).*(?=\.)' <<< ${{ inputs.DEVICE_TREE_URL }}) + REMOTE_FETCH=$(grep -oP '(?<=://).*?(?=\/)' <<< ${{ inputs.DEVICE_TREE_URL }}) + if [ "${REMOTE_NAME}" != "github" ]; then + sed -i "s%\!--remote name=\"{REMOTE_NAME}%remote name=\"${REMOTE_NAME}%g" .repo/local_manifests/roomservice.xml + sed -i "s%{REMOTE_FETCH}\"/-->%${REMOTE_FETCH}\"/>%g" .repo/local_manifests/roomservice.xml + fi + sed -i "s%\!--project name=\"{DEVICE_TREE_URL_REPO}%project name=\"$(grep -oP "(?<=${REMOTE_FETCH}/).*" <<< ${{ inputs.DEVICE_TREE_URL }})%g" .repo/local_manifests/roomservice.xml sed -i "s%{DEVICE_PATH}%${{ inputs.DEVICE_PATH }}%g" .repo/local_manifests/roomservice.xml - sed -i "s%{DEVICE_REMOTE_NAME}%github%g" .repo/local_manifests/roomservice.xml + sed -i "s%{DEVICE_REMOTE_NAME}%${REMOTE_NAME}%g" .repo/local_manifests/roomservice.xml sed -i "s%{DEVICE_TREE_BRANCH}\"/-->%${{ inputs.DEVICE_TREE_BRANCH }}\"/>%g" .repo/local_manifests/roomservice.xml repo sync -j$(nproc --all) working-directory: workspace diff --git a/templates/roomservice.xml b/templates/roomservice.xml index 2babebc7b..ac25370ee 100755 --- a/templates/roomservice.xml +++ b/templates/roomservice.xml @@ -1,4 +1,6 @@ +