Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion domain-replacer/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ runs:
shell: bash
run: |
chmod +x ${{ github.action_path }}/replace.sh
${{ github.action_path }}/replace.sh "${{ inputs.file-glob }}"
${{ github.action_path }}/replace.sh "${{ inputs.file-glob }}"
env:
REPLACEMENT_DOMAIN: ${{ secrets.INTERNALDOMAIN }}
11 changes: 8 additions & 3 deletions domain-replacer/replace.sh
Original file line number Diff line number Diff line change
@@ -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
done