Skip to content

Commit 64066bf

Browse files
committed
scripts: improve validate_docs to not add the dependency if already there
1 parent 7a314a6 commit 64066bf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/scripts/validate_docs.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
set -e
44
set -x
55

6-
cat <<EOF >> Package.swift
6+
DEPENDENCY='.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0")'
7+
8+
if grep -q "$DEPENDENCY" Package.swift; then
9+
echo "Package.swift already contains 'swift-docc-plugin"
10+
else
11+
cat <<EOF >> Package.swift
712
813
package.dependencies.append(
9-
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0")
14+
$DEPENDENCY
1015
)
1116
EOF
17+
fi
1218

1319
swift package --disable-sandbox plugin generate-documentation --target "SwiftJavaDocumentation" --warnings-as-errors --analyze

0 commit comments

Comments
 (0)