Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sed failure in auto-check #43

Closed
plastikfan opened this issue Apr 28, 2024 · 1 comment Β· Fixed by #44 or #46
Closed

fix sed failure in auto-check #43

plastikfan opened this issue Apr 28, 2024 · 1 comment Β· Fixed by #44 or #46
Assignees
Labels
chore Non source related, infrasture change

Comments

@plastikfan
Copy link
Contributor

auto-check
---> 😎 OWNER: snivilised
---> 🧰 REPO: traverse

🎯 ---> title: πŸ’₯ update-workflow-names
βœ… ---> file pattern: *.yml
βœ… ---> folder: .github/workflows
βœ… ---> target: name: astrolib
βœ… ---> replacement: name: Traverse
sed: 1: ".github/workflows/relea ...": invalid command code .
sed: 1: ".github/workflows/ci-wo ...": invalid command code .
sed: 1: ".github/workflows/auto- ...": invalid command code .
!!! β›” Aborted! update-all-generic failed for snivilised/traverse:

@plastikfan plastikfan added the chore Non source related, infrasture change label Apr 28, 2024
@plastikfan plastikfan self-assigned this Apr 28, 2024
@plastikfan
Copy link
Contributor Author

old code(function update-all-generic):

find $folder -name "$name" -type f -print -exec sed -i "s/${target}/${replacement}/g" {} +

  if [ $? -ne 0 ]; then
    echo "!!! β›” Aborted! update-all-generic failed for $owner/$repo:"
    return 1
  fi

new code(function update-all-generic):

find "$folder" -name "$name" -type f -print0 | while IFS= read -r -d '' file; do
    echo "Processing file: $file"
    if ! sed "s/${target}/${replacement}/g" "$file" > "$file.tmp" && mv "$file.tmp" "$file"; then
      echo "!!! β›” Sed failed for $file"
      return 1
    fi
  done

It looks like there was a problem in how sed handles files with names that contain - (ci-workflow.xml, release-workflow)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Non source related, infrasture change
Projects
None yet
1 participant