Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
public-apis
Commits
4885264c
Commit
4885264c
authored
Jul 23, 2017
by
Dave Machado
Committed by
GitHub
Jul 23, 2017
Browse files
Merge pull request #388 from davemachado/feature/build-pull-requests
Validate PR updates exclusively
parents
4744fdbe
90e4670c
Changes
2
Hide whitespace changes
Inline
Side-by-side
build/main.sh
View file @
4885264c
#!/bin/bash
FORMAT_FILE
=
../README.md
if
[
"
$TRAVIS_PULL_REQUEST
"
!=
"false"
]
;
then
echo
"running on Pull Request #
$TRAVIS_PULL_REQUEST
"
git show | egrep
"
\+
"
>
additions.txt
echo
"--ADDITIONS--"
cat
additions.txt
LINK_FILE
=
additions.txt
else
echo
"running on
$TRAVIS_BRANCH
branch"
LINK_FILE
=
../README.md
fi
echo
"running format validation..."
./validate_format.rb
../README.md
./validate_format.rb
$FORMAT_FILE
if
[[
$?
!=
0
]]
;
then
echo
"format validation failed!"
exit
1
...
...
@@ -10,11 +22,14 @@ fi
if
[
"
$TRAVIS_BRANCH
"
==
"master"
]
;
then
echo
"running link validation..."
./validate_links.rb
../README.md
./validate_links.rb
$LINK_FILE
if
[[
$?
!=
0
]]
;
then
echo
"link validation failed!"
exit
1
else
if
[
"
$TRAVIS_PULL_REQUEST
"
==
"false"
]
;
then
echo
"no links to check on
$TRAVIS_BRANCH
branch - script failure!"
fi
echo
"link validation passed!"
fi
fi
build/validate_links.rb
View file @
4885264c
...
...
@@ -17,6 +17,10 @@ raw_links.each do |link|
links
.
push
(
link
)
end
end
if
links
.
length
<=
0
puts
"no links to check"
exit
(
0
)
end
fails
=
[]
# Fail on any duplicate elements
dup
=
links
.
select
{
|
element
|
links
.
count
(
element
)
>
1
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment