diff --git a/.github/workflows/actions.yaml b/.github/workflows/actions.yaml index 2687e56c..bbd7b23d 100644 --- a/.github/workflows/actions.yaml +++ b/.github/workflows/actions.yaml @@ -47,8 +47,19 @@ jobs: run: | git config user.name "github-actions" git config user.email "github-actions@github.com" - git fetch origin domain-replacement || true - git checkout -B domain-replacement + + # Check if the branch exists remotely + if git ls-remote --exit-code --heads origin domain-replacement; then + echo "Branch 'domain-replacement' exists. Checking it out." + git fetch origin domain-replacement + git checkout domain-replacement + else + echo "Branch 'domain-replacement' does not exist. Creating it." + git checkout -b domain-replacement + fi + + # git fetch origin domain-replacement || true + # git checkout -B domain-replacement git add . ':!./.github/workflows/' ':!./.github/workflows/domain-replacer/' if git diff --cached --quiet; then echo "No changes to commit." diff --git a/.github/workflows/domain-replacer/replace.sh b/.github/workflows/domain-replacer/replace.sh index 5e4a33c1..fafcd886 100755 --- a/.github/workflows/domain-replacer/replace.sh +++ b/.github/workflows/domain-replacer/replace.sh @@ -24,7 +24,7 @@ set -e echo "Scanning for files to update..." -find . -type f ! -path "./.github/workflows/*" | while read -r file; do +find . -type f ! -name "go.sum" ! -path "./.github/workflows/*" | while read -r file; do echo "Checking $file" if grep -q 'github.com/dell/' "$file"; then echo "Updating $file"