diff --git a/domain-replacer/action.yaml b/domain-replacer/action.yaml index 1e470d1e..f5b262f3 100644 --- a/domain-replacer/action.yaml +++ b/domain-replacer/action.yaml @@ -8,4 +8,6 @@ runs: shell: bash run: | chmod +x ${{ github.action_path }}/replace.sh - ${{ github.action_path }}/replace.sh "${{ inputs.file-glob }}" \ No newline at end of file + ${{ github.action_path }}/replace.sh "${{ inputs.file-glob }}" + env: + REPLACEMENT_DOMAIN: ${{ secrets.INTERNALDOMAIN }} diff --git a/domain-replacer/replace.sh b/domain-replacer/replace.sh index ffe6bc6a..212810c2 100644 --- a/domain-replacer/replace.sh +++ b/domain-replacer/replace.sh @@ -1,13 +1,18 @@ +#!/bin/bash set -e echo "Scanning for files to update..." +# Ensure REPLACEMENT_DOMAIN is set +if [ -z "$REPLACEMENT_DOMAIN" ]; then + echo "Error: REPLACEMENT_DOMAIN environment variable is not set." + exit 1 +fi -#find . -type f ! -name "go.sum" ! -path "./domain-replacer/*" ! -path "./.github/workflows/*" | while read -r file; do find . -type f ! -name "go.sum" | while read -r file; do echo "Checking $file" if grep -q 'github.com/dell/' "$file"; then echo "Updating $file" - sed -i 's|github.com/dell/|eos2git.cec.lab.emc.com/CSM/|g' "$file" + sed -i "s|github.com/dell/|$REPLACEMENT_DOMAIN|g" "$file" fi -done \ No newline at end of file +done