Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
915937b
Fixed list of abbreviations.
Stina-Gremme Jun 18, 2025
bd7df44
Update LLM cache [skip ci]
actions-user Jun 18, 2025
c8f7586
Pipeline update
mckeea Jun 18, 2025
63e36b5
Update LLM cache [skip ci]
actions-user Jun 18, 2025
871a514
chore(ci): merge DOCS/it-principles from publish-it-principles-202506…
Jun 19, 2025
076bde1
Update LLM cache [skip ci]
actions-user Jun 19, 2025
e3277c9
chore(ci): merge DOCS/it-principles from publish-it-principles-202506…
Jun 19, 2025
5d37411
Update LLM cache [skip ci]
actions-user Jun 19, 2025
7055013
chore(ci): merge DOCS/it-principles from publish-it-principles-202506…
Jun 19, 2025
c4aba6a
Update LLM cache [skip ci]
actions-user Jun 19, 2025
75f6220
chore(ci): merge DOCS/it-principles from publish-it-principles-202506…
Jun 19, 2025
6c4ac0e
Update LLM cache [skip ci]
actions-user Jun 19, 2025
7d415c8
chore(ci): merge DOCS/it-principles from publish-it-principles-202506…
Jun 19, 2025
0d37bd4
chore(ci): merge DOCS/it-principles from publish-it-principles-202506…
Jun 19, 2025
59f5e3d
Update LLM cache [skip ci]
actions-user Jun 19, 2025
323e0a3
Editor Manual updated
mckeea Jun 23, 2025
43f3d41
Update LLM cache [skip ci]
actions-user Jun 23, 2025
b98fe3b
Fix for searchbar on index pages
mckeea Jun 25, 2025
0665ff7
Urban atlas: styling for contact info updated
mckeea Jul 2, 2025
1ee4077
Update LLM cache [skip ci]
actions-user Jul 2, 2025
af62f85
Coastal Zones translation + media files
Stina-Gremme Jul 11, 2025
3ad6468
Update LLM cache [skip ci]
actions-user Jul 11, 2025
0456def
Fix for incorrect anchoring
mckeea Jul 14, 2025
1df75f3
Update LLM cache [skip ci]
actions-user Jul 14, 2025
cf0d7ef
Don't make html self-contained to avoid large files
mckeea Jul 14, 2025
bc5967d
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
mckeea Jul 14, 2025
0632703
Fixing smaller issues.
Stina-Gremme Jul 15, 2025
529b3fc
Update LLM cache [skip ci]
actions-user Jul 15, 2025
481bc9a
Styling improvement
mckeea Jul 16, 2025
2586f7b
adding "contact" and pagebreak before intro
Stina-Gremme Jul 17, 2025
6f19d04
Update LLM cache [skip ci]
actions-user Jul 17, 2025
ce3df67
Added empty line infront of "Contact"
Stina-Gremme Jul 21, 2025
edacac4
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Jul 21, 2025
1d971bc
Update LLM cache [skip ci]
actions-user Jul 21, 2025
b82cdff
renamed Riparian Zones Nomenclature Guideline
Stina-Gremme Jul 28, 2025
0473fee
Update LLM cache [skip ci]
actions-user Jul 28, 2025
a20ea5f
Translated Riparian Zones PUM (2023) + media files
Stina-Gremme Jul 28, 2025
ce2ee14
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Jul 28, 2025
a218327
Update LLM cache [skip ci]
actions-user Jul 28, 2025
601d4ad
fixed formatting issues.
Stina-Gremme Jul 28, 2025
23dd76b
changed yaml
Stina-Gremme Jul 28, 2025
7f7d57f
Update LLM cache [skip ci]
actions-user Jul 28, 2025
bfddc64
Translated EGMS product description
Stina-Gremme Jul 29, 2025
619e637
Update LLM cache [skip ci]
actions-user Jul 29, 2025
2ad7a15
Rename image3.PNG to image3.png
Stina-Gremme Jul 29, 2025
11df1e6
Rename image4.PNG to image4.png
Stina-Gremme Jul 29, 2025
7820304
fixing some smaller issues
Stina-Gremme Jul 29, 2025
42138dc
Update LLM cache [skip ci]
actions-user Jul 29, 2025
aa56a9a
Fixed titles
Stina-Gremme Jul 31, 2025
8c96ebd
Update LLM cache [skip ci]
actions-user Jul 31, 2025
b206859
fixed pagebreaks
Stina-Gremme Aug 4, 2025
d0371f3
Update LLM cache [skip ci]
actions-user Aug 4, 2025
2329b8d
fixed pagebreaks
Stina-Gremme Aug 4, 2025
e8bae3b
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Aug 4, 2025
a759810
Update LLM cache [skip ci]
actions-user Aug 4, 2025
ae8a5f6
Translated HRL_VLCC_ATBD
Stina-Gremme Aug 15, 2025
f29ee19
Update LLM cache [skip ci]
actions-user Aug 15, 2025
bed1c33
fixed YAML
Stina-Gremme Aug 18, 2025
b788983
Update LLM cache [skip ci]
actions-user Aug 18, 2025
955f8b2
LibreOffice macro update: auto-format logic for tables, tables' image…
mckeea Aug 19, 2025
382a7dd
Update build-docs.sh: timeout for docx2pdf increased to 25m
mckeea Aug 19, 2025
8ea6d33
Update build-docs.sh
mckeea Aug 19, 2025
b51285b
Made some smaller fixes
Stina-Gremme Aug 20, 2025
20b3f05
Update LLM cache [skip ci]
actions-user Aug 20, 2025
ba75ea1
Improved macro to process .docx files
mckeea Aug 20, 2025
bde036d
Fixed smaller issues in all qmd files
Stina-Gremme Aug 21, 2025
f977737
Update LLM cache [skip ci]
actions-user Aug 21, 2025
67301c2
Office macro updates
mckeea Aug 24, 2025
0fe7681
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
mckeea Aug 24, 2025
1111ded
Update LLM cache [skip ci]
actions-user Aug 24, 2025
3e51608
install needed npm packages
mckeea Aug 24, 2025
1a20c43
install needed npm packages
mckeea Aug 24, 2025
a00fa92
build script updates
mckeea Aug 24, 2025
16ce572
Fixed document name (Technical)
Stina-Gremme Aug 27, 2025
7fa032e
Update LLM cache [skip ci]
actions-user Aug 27, 2025
ed37db1
Conversion of .csv document
Stina-Gremme Sep 8, 2025
fb960f8
Update LLM cache [skip ci]
actions-user Sep 8, 2025
706e75d
Converted EGMS ATBD v4.0
Stina-Gremme Sep 9, 2025
c5973ba
Update LLM cache [skip ci]
actions-user Sep 9, 2025
94e81f3
Workflow update: gropu by category, dynamic linking, 404 page
mckeea Sep 9, 2025
14d5b82
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
mckeea Sep 9, 2025
784ab07
Update LLM cache [skip ci]
actions-user Sep 9, 2025
48c23c1
Small fix
mckeea Sep 9, 2025
f925afd
Small fix
mckeea Sep 9, 2025
5fa3f0f
Small fix
mckeea Sep 9, 2025
bb6d9bc
Small fix
mckeea Sep 9, 2025
492f44b
Scripts update
mckeea Sep 9, 2025
2a08442
Update LLM cache [skip ci]
actions-user Sep 9, 2025
3563d30
doc update
mckeea Sep 9, 2025
60c00d6
Update LLM cache [skip ci]
actions-user Sep 9, 2025
d790dba
Fixed some chapter headers.
Stina-Gremme Sep 11, 2025
a11c9dc
Update LLM cache [skip ci]
actions-user Sep 11, 2025
d226b1f
Aligned media folder with qmd file (Urban Atlas Building Block Hight …
Stina-Gremme Sep 11, 2025
789c208
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 11, 2025
e36ddd0
Update LLM cache [skip ci]
actions-user Sep 11, 2025
bfc1e68
Aligned media folder with qmd file (Coastal Zones 2012-2018 Nomenclat…
Stina-Gremme Sep 11, 2025
fcbfab2
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 11, 2025
34791ac
Update LLM cache [skip ci]
actions-user Sep 11, 2025
7f5eecd
Aligned media folder with qmd file (EMGS Product description 2023)
Stina-Gremme Sep 11, 2025
734a553
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 11, 2025
0fb5ab9
Update LLM cache [skip ci]
actions-user Sep 11, 2025
189830a
Aligned media folder with qmd file (N2K PUM)
Stina-Gremme Sep 11, 2025
7784e91
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 11, 2025
0422fc4
Update LLM cache [skip ci]
actions-user Sep 11, 2025
c7fdf18
Aligned media folder with qmd file (Riparian Zones Nomenclature Guide…
Stina-Gremme Sep 11, 2025
f586549
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 11, 2025
f5e8012
Update LLM cache [skip ci]
actions-user Sep 11, 2025
503eb1e
Aligned media folder with qmd file (Urban Atlas mapping guide V6.3)
Stina-Gremme Sep 11, 2025
42fef9b
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 11, 2025
d989e34
Update LLM cache [skip ci]
actions-user Sep 11, 2025
448a293
Added contact line
Stina-Gremme Sep 15, 2025
7cd643d
Fixed path to media folder
Stina-Gremme Sep 15, 2025
7cda712
Update LLM cache [skip ci]
actions-user Sep 15, 2025
0f23bbc
Converted HRL Grasslands PUM + media
Stina-Gremme Sep 15, 2025
8760b2e
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 15, 2025
c53e737
Update LLM cache [skip ci]
actions-user Sep 15, 2025
d293bb2
Converted CLDS survey report. plus, fixed title of HRL Grassland PUM
Stina-Gremme Sep 16, 2025
f6da1ef
Merge branch 'develop' of https://github.com/eea/CLMS_documents into …
Stina-Gremme Sep 16, 2025
f52afa9
Update LLM cache [skip ci]
actions-user Sep 16, 2025
ca9e3ff
doc category update
mckeea Sep 10, 2025
dc08f87
Update guideline template
mckeea Sep 16, 2025
b85c9b6
Update LLM cache [skip ci]
actions-user Sep 16, 2025
e1aac1e
Config updates
mckeea Sep 16, 2025
cdcc0c3
Publish .docx files at develop env
mckeea Sep 17, 2025
701a94f
Disable DOCX temporarly
mckeea Sep 18, 2025
04fa0c0
Optimized images added
mckeea Sep 23, 2025
aada162
Update LLM cache [skip ci]
actions-user Sep 23, 2025
93f54c7
_quarto.yml update
mckeea Sep 23, 2025
864bf91
Fix to correctly handle media after grouping (by category) when multi…
mckeea Sep 24, 2025
c30878e
Update LLM cache [skip ci]
actions-user Sep 24, 2025
6dc318c
various improvements
mckeea Sep 28, 2025
45d6c53
Update LLM cache [skip ci]
actions-user Sep 28, 2025
f7895b7
small fix
mckeea Sep 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .github/non_browsable_doc_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"_comment": "This file maps non-browsable QMD source files to their persistent random output names and URLs. Do not publish this file.",
"mappings": [
{
"source": "it-principles/IT_Architecture_Principles_and_Implementation_Guidelines.qmd",
"base": "smnkbw05zgz5l0llz5tefwxrowqqds6c36zi1i9ssswbslnleuj28yc5c7sui5pl",
"url": "/smnkbw05zgz5l0llz5tefwxrowqqds6c36zi1i9ssswbslnleuj28yc5c7sui5pl.html"
}
]
}
84 changes: 61 additions & 23 deletions .github/scripts/build-docs.sh
Original file line number Diff line number Diff line change
@@ -1,51 +1,89 @@
#!/bin/bash
set -e

echo "🖼 Render all documents into to HTML/DOCX"
echo "🔄 Copying DOCS to origin_DOCS..."
mv DOCS origin_DOCS

echo "🔄 Updating URL mappings..."
python3 .github/scripts/update_url_mappings.py

echo "🔄 Grouping documents by category..."
python3 .github/scripts/group_docs_by_category.py

# Change to DOCS directory as it'll be the root of rendered content
cd DOCS
# Link assets to origin_DOCS as these files need to be served from rendered content
ln -s ../assets assets


echo "🖼 Render all documents to HTML"
if [[ -n "$SKIP_DOCX" ]]; then
echo " (DOCX generation will be skipped)"
else
echo " (DOCX generation will follow)"
fi
sudo cp /usr/bin/chromium /usr/bin/chromium-browser
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render --to docx
find _site -type f -name 'index.docx' -delete

# Set up quarto configuration based on environment variables
if [[ -n "$SKIP_DOCX" ]]; then
echo "📄 Using configuration for DOCX cleanup (HTML only)"
cp _quarto-no-headers.yml _quarto.yml
else
echo "📄 Using default configuration (HTML + DOCX files kept)"
# _quarto.yml is already the default with headers - no copying needed
fi

QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render --to html --no-clean

# Backup the correct sitemap as it may be overwritten by next operations
sleep 5
mv _site/sitemap.xml _site/sitemap.xml.bkp

# Generate DOCX files (always needed for PDF conversion)
echo "📄 Generating DOCX files for PDF conversion..."
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render --to docx --no-clean
find _site -type f -name 'index.docx' -delete

echo "🛠 Generate index.qmd files for all DOCS/* folders"e
node .github/scripts/generate_index_all.mjs
node ../.github/scripts/generate_index_all.mjs

echo "📄 Render only index.qmd files using 'index' profile"
mv _quarto.yml _quarto_not_used.yml
mv _quarto-index.yml _quarto.yml
find DOCS -type f -name index.qmd -print0 | while IFS= read -r -d '' src; do
find ./ -type f -name index.qmd -print0 | while IFS= read -r -d '' src; do
echo "🔧 Rendering $src using profile=index..."
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render "$src" --profile index --to html --no-clean
QUARTO_CHROMIUM_HEADLESS_MODE=new quarto render "$src" --profile index --to html --no-clean $QUARTO_FLAGS
done
mv _quarto.yml _quarto-index.yml
cp _quarto_not_used.yml _quarto.yml && rm _quarto_not_used.yml

echo "🔄 Additional processing of index.html file"
echo '<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url=DOCS/index.html" />
<title>Redirecting...</title>
</head>
<body>
<p>If you are not redirected automatically, <a href="DOCS/index.html">click here</a>.</p>
</body>
</html>' > _site/index.html

echo "📄 Converting .docx files to .pdf..."
timeout 3s ../.github/scripts/convert_docx_to_pdf.sh || true
timeout 10m ../.github/scripts/convert_docx_to_pdf.sh

# Clean up DOCX files if requested (they're only needed for PDF conversion)
if [[ -n "$SKIP_DOCX" ]]; then
echo "🗑️ Cleaning up DOCX files (keeping only PDFs and HTML)..."
find _site -name "*.docx" -type f -delete
echo " ✅ DOCX files removed to save space"
else
echo "💾 Keeping DOCX files for download/access"
fi

# Revert the correct sitemap
cp _site/sitemap.xml.bkp _site/sitemap.xml
rm -f _site/sitemap.xml.bkp

echo "📄 Converting .docx files to .pdf..."
#chmod +x ./convert_docx_to_pdf.sh
timeout 3s .github/scripts/convert_docx_to_pdf.sh || true
timeout 10m .github/scripts/convert_docx_to_pdf.sh
# Remove non-browsable links from sitemap.xml
python3 ../.github/scripts/remove_non_browsable_from_sitemap.py _site/sitemap.xml

echo "🧹 Cleaning up..."
find _site -type f -name '*.docx' -delete
find _site -type f -name '*.qmd' -delete

cp ../404.html _site/404.html
cp ../redirect_map.json _site/redirect_map.json
cp ../url_mapping.json _site/url_mapping.json


echo "✅ Docs built successfully"
echo "✅ Docs built successfully"
2 changes: 1 addition & 1 deletion .github/scripts/convert_docx_to_pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#set -euo pipefail

RENDERED_DOCS_DIR="../../_site"
RENDERED_DOCS_DIR="../../DOCS/_site"

# Set the working directory to the script's location
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
Expand Down
1 change: 1 addition & 0 deletions .github/scripts/external_publish_before.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ run_git "Configuring Git user name" config --global user.name "ci_docker_builder
run_git "Configuring Git user email" config --global user.email "[email protected]"

run_git "Setting remote URL" remote set-url origin [email protected]:${GITHUB_REPOSITORY}.git
#run_git "Fetching origin develop branch" fetch origin develop

echo "✅ Environment ready."
199 changes: 129 additions & 70 deletions .github/scripts/external_publish_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,85 +3,144 @@ set -euo pipefail

source "$(dirname "$0")/helpers/git-utils.sh"


echo "🚀 Starting validation..."
PROJECT_NAME=$(echo "$PUBLISH_BRANCH" | sed -E 's/^publish-(.+)-[0-9]{8}-[0-9]{6}$/\1/')
echo "Project: $PROJECT_NAME"

echo "🔎 Checking files inside publish branch (fast tree scan)..."
run_git "fetching develop branch" fetch origin develop
PUBLISH_COMMIT=$(git rev-parse origin/${PUBLISH_BRANCH})
echo "PUBLISH_COMMIT: $PUBLISH_COMMIT"

git ls-tree -r --name-only "$PUBLISH_COMMIT" > changed-files.txt
sed -i '/^\.gitignore$/d; /^\.github\/workflows\/trigger\.yml$/d' changed-files.txt
cat changed-files.txt

INVALID_FILES=$(grep -v "^DOCS/${PROJECT_NAME}/" changed-files.txt || true)
if [ -n "$INVALID_FILES" ]; then
echo "❌ Changes outside DOCS/${PROJECT_NAME} detected:"
echo "$INVALID_FILES"
exit 1
fi

echo "✅ Folder validation passed."

echo "🔀 Preparing secure diff-aware merge into develop..."
git checkout develop
git pull origin develop
mkdir -p tmp_publish
git archive "$PUBLISH_COMMIT" DOCS/"$PROJECT_NAME" | tar -x -C tmp_publish

# ✅ Remove any GitHub workflows injected into the subtree
rm -rf tmp_publish/DOCS/"${PROJECT_NAME}"/.github
rm -rf tmp_publish/DOCS/"${PROJECT_NAME}"/.gitignore

echo "🔍 Finding modified and deleted files only..."
MODIFIED_FILES=()
while IFS= read -r file; do
if [ ! -f "$file" ] || ! cmp -s "$file" "tmp_publish/$file"; then
MODIFIED_FILES+=("$file")
fi
done < <(find tmp_publish/DOCS/"$PROJECT_NAME" -type f | sed 's|tmp_publish/||')

DELETED_FILES=()
while IFS= read -r file; do
if [ ! -f "tmp_publish/$file" ]; then
DELETED_FILES+=("$file")
fi
done < <(find DOCS/"$PROJECT_NAME" -type f)

if [ "${#MODIFIED_FILES[@]}" -eq 0 ] && [ "${#DELETED_FILES[@]}" -eq 0 ]; then
echo "🟡 No real changes to DOCS/$PROJECT_NAME — skipping commit."
exit 0
fi

echo "✅ Modified files:"
printf '%s\n' "${MODIFIED_FILES[@]}"
echo "🗑️ Deleted files:"
printf '%s\n' "${DELETED_FILES[@]}"

for file in "${MODIFIED_FILES[@]}"; do
mkdir -p "$(dirname "$file")"
cp "tmp_publish/$file" "$file";
done
TEMP_WORKSPACE="tmp_publish"

if [ "${#DELETED_FILES[@]}" -gt 0 ]; then
run_git "removing deleted files" rm "${DELETED_FILES[@]}"
fi
for file in "${MODIFIED_FILES[@]}"; do
run_git "adding $file to staging" add "$file"
done
echo "Project: $PROJECT_NAME"
echo "PUBLISH_COMMIT: $PUBLISH_COMMIT"

COMMIT_MSG=$(cat <<EOF
get_changed_files() {
git ls-tree -r --name-only "$PUBLISH_COMMIT" > changed-files.txt
# Remove specific files we want to ignore
sed -i '/^\.gitignore$/d; /^\.github\/workflows\/trigger\.yml$/d' changed-files.txt
cat changed-files.txt
}

check_files_within_project() {
local invalid_files

invalid_files=$(grep -v "^DOCS/${PROJECT_NAME}/" changed-files.txt || true)

if [ -n "$invalid_files" ]; then
echo "❌ Changes outside DOCS/${PROJECT_NAME} detected:"
echo "$invalid_files"
return 1
fi

echo "✅ All changes within project boundaries"
return 0
}

prepare_merge_environment() {
echo "🔀 Preparing secure diff-aware merge into develop..."
git checkout develop
git pull origin develop
mkdir -p "$TEMP_WORKSPACE"
git archive "$PUBLISH_COMMIT" DOCS/"$PROJECT_NAME" | tar -x -C $TEMP_WORKSPACE
}

# Remove any GitHub workflows injected into the subtree
cleanup_extracted_files() {
echo "🧹 Cleaning up extracted files..."
rm -rf "$TEMP_WORKSPACE"/DOCS/"${PROJECT_NAME}"/.github
rm -rf "$TEMP_WORKSPACE"/DOCS/"${PROJECT_NAME}"/.gitignore
}

find_file_changes() {
echo "🔍 Finding modified and deleted files..."

# Find modified files
MODIFIED_FILES=()
while IFS= read -r file; do
if [ ! -f "$file" ] || ! cmp -s "$file" "$TEMP_WORKSPACE/$file"; then
MODIFIED_FILES+=("$file")
fi
done < <(find "$TEMP_WORKSPACE"/DOCS/"$PROJECT_NAME" -type f | sed "s|$TEMP_WORKSPACE/||")

# Find deleted files
DELETED_FILES=()
while IFS= read -r file; do
if [ ! -f "$TEMP_WORKSPACE/$file" ]; then
DELETED_FILES+=("$file")
fi
done < <(find DOCS/"$PROJECT_NAME" -type f)
}

check_for_changes() {
if [ "${#MODIFIED_FILES[@]}" -eq 0 ] && [ "${#DELETED_FILES[@]}" -eq 0 ]; then
echo "🟡 No real changes to DOCS/$PROJECT_NAME — skipping commit."
return 1
fi

echo "✅ Modified files:"
printf '%s\n' "${MODIFIED_FILES[@]}"
echo "🗑️ Deleted files:"
printf '%s\n' "${DELETED_FILES[@]}"

return 0
}

apply_file_changes() {
echo "📝 Applying file changes..."

# Copy modified files
for file in "${MODIFIED_FILES[@]}"; do
mkdir -p "$(dirname "$file")"
cp "$TEMP_WORKSPACE/$file" "$file"
done

# Remove deleted files
if [ "${#DELETED_FILES[@]}" -gt 0 ]; then
run_git "removing deleted files" rm "${DELETED_FILES[@]}"
fi

# Stage modified files
for file in "${MODIFIED_FILES[@]}"; do
run_git "adding $file to staging" add "$file"
done
}

generate_commit_message() {
cat <<EOF
chore(ci): merge DOCS/$PROJECT_NAME from $PUBLISH_BRANCH

Triggered by: CI Workflow
Branch: $PUBLISH_BRANCH
Commit: $PUBLISH_COMMIT
Repo: https://github.com/$GITHUB_REPOSITORY/commit/$PUBLISH_COMMIT
EOF
)
}

commit_and_push_changes() {
local commit_msg
commit_msg=$(generate_commit_message)

echo "💾 Committing and pushing changes..."
run_git "committing changes to develop branch" commit -m "$commit_msg"
run_git "pushing changes to develop branch" push origin develop
}

########## Main logic ##########

# 1. Get changed files in the publish branch
echo "🔎 Checking files inside publish branch (fast tree scan)..."
run_git "fetching develop branch" fetch origin develop

get_changed_files

# 2. Validate that the changes are correctly scoped to the project and are correct
check_files_within_project || exit 1
python .github/scripts/validate_qmd_files.py || exit 1

# 3. Merge the changes into develop
prepare_merge_environment
cleanup_extracted_files
find_file_changes

if ! check_for_changes; then
exit 0
fi

run_git "committing changes to develop branch" commit -m "$COMMIT_MSG"
run_git "pushing changes to develop branch" push origin develop
apply_file_changes
commit_and_push_changes
Loading