Skip to content

Commit 6d70170

Browse files
committed
github-actionify.sh: fix sed expressions
The repoSlug contains a slash, which will affect the expression if slash is used as the delimiter. So we change to semicolon. The command "sed -i" with no extension does not work with BSD sed (e.g. macOS); you need to write "sed -i ''" to avoid saving the previous file to a backup. But this doesn't work with GNU sed, which requires "sed -i''" or simply "sed -i" instead. The only way I know that works with both sed flavors is to give the flag as "-i.bak" and then delete the .bak file afterward.
1 parent 24c5403 commit 6d70170

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

github-actionify.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ process() {
109109

110110
# Change pom.xml from Travis CI to GitHub Action
111111
domain="github.com"
112-
sed -i 's/Travis CI/GitHub Actions/g' pom.xml
113-
sed -i "s/travis-ci.*/github.com\/$repoSlug\/actions\/workflows\/\.gitaction\.yml<\/url>/g" pom.xml
112+
sed -i.bak 's/Travis CI/GitHub Actions/g' pom.xml
113+
sed -i.bak "s;travis-ci.*;github.com/$repoSlug/actions/workflows/.gitaction.yml</url>;g" pom.xml
114+
rm -f pom.xml.bak
114115

115116
# -- GitHub Action sanity checks --
116117

0 commit comments

Comments
 (0)