forked from jenkins-infra/jenkins.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck-hard-coded-URL-references
executable file
·39 lines (31 loc) · 1.49 KB
/
check-hard-coded-URL-references
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Report adoc files that use https://www.jenkins.io or https://jenkins.io
# Site development depends on links being relative to the current site
# so that we can show the site on a developer desktop or in the preview
# sites without links that jump to the original site.
# See https://github.com/jenkins-infra/jenkins.io/issues/5718
# See also https://github.com/jenkins-infra/jenkins.io/pull/5715
# Returns 0 if no issues are detected or script is running on trusted.ci.jenkins.io
# Returns 1 if one or more adoc files include https://www.jenkins.io
# Returns 2 if one or more adoc files include https://jenkins.io
# Returns 3 if both https://www.jenkins.io and https://jenkins.io are found
return_code=0
files=$(git grep -l https://www.jenkins.io -- content/[a-zA-Z]**/*.adoc)
if [ "$files" != "" ]; then
echo "ERROR: incorrectly used https://www.jenkins.io in ${files}"
echo
echo "See https://github.com/jenkins-infra/jenkins.io/issues/5718"
echo "See also https://github.com/jenkins-infra/jenkins.io/pull/5715"
echo
return_code=1
fi
files=$(git grep -l https://jenkins.io -- content/[a-zA-Z]**/*.adoc)
if [ "$files" != "" ]; then
echo "ERROR: incorrectly used https://jenkins.io in ${files}"
echo
echo "See https://github.com/jenkins-infra/jenkins.io/issues/5718"
echo "See also https://github.com/jenkins-infra/jenkins.io/pull/5715"
echo
return_code=$(( return_code + 2 ))
fi
exit $return_code