Skip to content
Closed
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: 2 additions & 2 deletions .github/fileUpdater/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: 'Update'
description: 'Update strings'

inputs:
find:
description: String to replace
file:
description: 'Comma-separated list of files (e.g. README.md, LICENSE)'
required: true
replace:
description: Replacement string
Expand Down
27 changes: 22 additions & 5 deletions .github/fileUpdater/update.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
#!/bin/sh
#!/bin/bash

filename=$3
search=$1
replace=$2
FIND=$1
REPLACE=$2
FILES_INPUT=$3

sed -i -e "s/$search/$replace/g" $filename
# Split the comma-separated string into an array
IFS=',' read -ra FILES <<< "$FILES_INPUT"

for i in "${FILES[@]}"; do
# Remove any accidental spaces (like " README.md")
FILE=$(echo $i | xargs)

echo "Processing file: $FILE"

# Check if the file exists before trying to update it
if [ -f "$FILE" ]; then
# This is where your actual replacement command (likely 'sed') lives
# Make sure to use "$FILE" (the variable) here!
sed -i "s/$FIND/$REPLACE/g" "$FILE"
else
echo "Warning: $FILE not found, skipping."
fi
done
4 changes: 3 additions & 1 deletion .github/workflows/updateStringInRepos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ on:
default: 'y'
required: true
file:
description: 'File to replace in'
description: 'Comma-separated list of files (e.g. README.md, CONTRIBUTING.md)'
default: 'CONTRIBUTING.md'
required: true


env:
repo: ""
Expand Down