Skip to content

Commit

Permalink
Update sync-isp-function.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cc63 authored May 24, 2024
1 parent d341227 commit bd8a84d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/sync-isp-function.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ jobs:
# Define the file paths
SOURCE_FILE="Module/Panel/IP-info/Moore/IP-1.js"
TARGET_FILES=("Module/Panel/IP-info/Moore/IP-2.js" "Module/Panel/IP-info/Moore/IP-3.js" "Module/Panel/IP-info/Moore/IP-4.js")
# Extract the cleanIspInfo function from the source file
FUNCTION_CODE=$(sed -n '/function cleanIspInfo/,/^}/p' $SOURCE_FILE)
awk '/function cleanIspInfo/,/^}/' $SOURCE_FILE > /tmp/cleanIspInfo.js
# Iterate over the target files and replace the cleanIspInfo function
for TARGET_FILE in "${TARGET_FILES[@]}"; do
# Use sed to replace the old function with the new one
sed -i '/function cleanIspInfo/,/^}/c\'"$FUNCTION_CODE"'' $TARGET_FILE
sed -i '/function cleanIspInfo/,/^}/{
r /tmp/cleanIspInfo.js
d
}' $TARGET_FILE
done
# Check if there are any changes
Expand Down

0 comments on commit bd8a84d

Please sign in to comment.