Skip to content

Commit c6b8541

Browse files
clear target before copying (#25)
1 parent e4cf564 commit c6b8541

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/scripts/commit_and_push_to_target.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if git diff-index --quiet HEAD --; then
1010
echo "No changes"
1111
exit 0
1212

13+
echo "FINAL_COMMIT_MESSAGE: $FINAL_COMMIT_MESSAGE"
14+
1315
else
1416
git commit -m "$FINAL_COMMIT_MESSAGE" || { echo "Git commit failed"; exit 1; }
1517
git push origin main || { echo "Git push failed"; exit 1; }

src/scripts/copy_docs.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
#! /bin/bash
22

3+
ClearTarget() {
4+
echo "Clearing the target repository at: $FULL_TARGET_DOCS_PATH/$PROJECT_NAME"
5+
6+
# Check if the target path exists
7+
if [ -d "$FULL_TARGET_DOCS_PATH/$PROJECT_NAME" ]; then
8+
# Remove all content at the target path
9+
rm -rf "${FULL_TARGET_DOCS_PATH:?}/$PROJECT_NAME"
10+
echo "Existing docs at ${FULL_TARGET_DOCS_PATH:?}/$PROJECT_NAME removed."
11+
else
12+
echo "The target directory does not yet exist and will be created."
13+
fi
14+
}
15+
316
CopyDocs() {
417
echo "Copying documents to the target repository."
518
echo "Source: $FULL_SOURCE_DOCS_PATH"
619
echo "Destination: $FULL_TARGET_DOCS_PATH"
720

21+
echo "Clearing the target repository..."
22+
ClearTarget
23+
824
echo "Files to be copied:"
925
# Log the list of files to be copied
1026
find "$FULL_SOURCE_DOCS_PATH" -type f -print
1127
echo "----"
28+
1229
echo "Copying files..."
1330
cp -R "$FULL_SOURCE_DOCS_PATH" "$FULL_TARGET_DOCS_PATH/$PROJECT_NAME"
1431
echo "Documents copied successfully."

src/tests/parse_commit_info.bats

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ source ./src/scripts/parse_commit_info.sh
7979

8080
run ConstructCommitMessage "$REPO_NAME" "$COMMIT_MESSAGE" "$PR_NUMBER" "$COMMIT_HASH"
8181
[[ $output =~ orb\(sample-repo\):\ Fix:\ Commit\ for\ testing\ https://github.com/infinitered/sample-repo/commit/$COMMIT_HASH ]]
82+
8283
>&2 echo "Debug: Output = '$output'" # Verbose log
8384

8485
unset REPO_NAME

0 commit comments

Comments
 (0)