Skip to content

Commit 268456b

Browse files
committed
Attempt4: Manipulate HTTPSnippet with sded
1 parent 5582117 commit 268456b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ jobs:
3838
run: "sed -i '/window.FormData/i window = { FormData: {} }' build/httpsnippet-bundle.js"
3939

4040
- name: Fix HTTPSnippet export fail issue
41-
run: "sed -i '/})();/i window.HTTPSnippet = HTTPSnippet' build/httpsnippet-bundle.js"
41+
run: |
42+
LINE=$(awk '/var\s+HTTPSnippet/{print NR}' build/httpsnippet-bundle.js)
43+
echo 'HTTPSnippet line =', $LINE
44+
sed -i -e "1,$LINE p" -e "$((LINE+1)),\$"'!d;/})();/i window.HTTPSnippet = HTTPSnippet' build/httpsnippet-bundle.js
45+
4246
4347
- name: Publish script to a branch
4448
uses: EndBug/add-and-commit@v9 # You can change this to use a specific version.

0 commit comments

Comments
 (0)