8000 travisify.sh: improve README badge hacking · oeway/scijava-scripts@2e97cbb · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e97cbb

Browse files
committed
travisify.sh: improve README badge hacking
Only change the README if the badge is not there. And add the matching URL from pom.xml, if available.
1 parent 521aee3 commit 2e97cbb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

travisify.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,12 @@ EOL
166166
fi
167167

168168
# update the README
169-
if ! grep -q "travis-ci.com/$repoSlug" README.md >/dev/null 2>&1
169+
if ! grep -q "travis-ci.\(com\|org\)/$repoSlug" README.md >/dev/null 2>&1
170170
then
171171
info "Adding Travis badge to README.md"
172-
echo "[![](https://travis-ci.com/$repoSlug.svg?branch=master)](https://travis-ci.com/$repoSlug)" >"$tmpFile"
172+
travisURL=$(grep travis-ci pom.xml | sed 's_.*<url>\(.*\)</url>.*_\1_')
173+
test "$travisURL" || travisURL="https://travis-ci.com/$repoSlug"
174+
echo "[![]($travisURL.svg?branch=master)]($travisURL)" >"$tmpFile"
173175
echo >>"$tmpFile"
174176
test -f README.md && cat README.md >>"$tmpFile"
175177
update README.md 'Travis: add badge to README.md'

0 commit comments

Comments
 (0)
0