From c1feabf8cac6ff96d129efbbba3fefe114bc0a8e Mon Sep 17 00:00:00 2001
From: Florent Torregrosa
 <14238-florenttorregrosa@users.noreply.drupalcode.org>
Date: Tue, 28 Jan 2025 16:51:35 +0000
Subject: [PATCH] Issue #3502879 by grimreaper, jonathan1055, fjgarlin: Build
 task fails on project without composer.json file

---
 includes/include.drupalci.main.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/includes/include.drupalci.main.yml b/includes/include.drupalci.main.yml
index 87914655..d7cd1b8a 100644
--- a/includes/include.drupalci.main.yml
+++ b/includes/include.drupalci.main.yml
@@ -474,8 +474,8 @@ stages:
     - echo -e "\e[0Ksection_end:`date +%s`:symlink_output\r\e[0K"
     # Delete the current composer.json, and then restore from backup if one was made earlier.
     - |
-      rm $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/composer.json
       if [[ -f composer.json.backup ]]; then
+        rm $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/composer.json
         echo "Restoring composer.json.backup to $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/composer.json"
         mv composer.json.backup $_WEB_ROOT/modules/custom/$CI_PROJECT_NAME/composer.json
       fi
-- 
GitLab