File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
.github/workflows/scripts Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -31,15 +31,23 @@ if [ -z "$package_files" ]; then
31
31
fatal " Package.swift not found. Please ensure you are running this script from the root of a Swift package."
32
32
fi
33
33
34
- for package_file in $package_files ; do
35
- log " Editing $package_file ..."
36
- cat << EOF >> "$package_file "
34
+ # yq 3.1.0-3 doesn't have filter, otherwise we could replace the grep call with "filter(.identity == "swift-docc-plugin") | keys | .[]"
35
+ hasDoccPlugin=$( swift package dump-package | yq -r ' .dependencies[].sourceControl' | grep -e " \" identity\" : \" swift-docc-plugin\" " || true)
36
+ if [[ -n $hasDoccPlugin ]]
37
+ then
38
+ log " swift-docc-plugin already exists"
39
+ else
40
+ log " Appending swift-docc-plugin"
41
+ for package_file in $package_files ; do
42
+ log " Editing $package_file ..."
43
+ cat << EOF >> "$package_file "
37
44
38
45
package.dependencies.append(
39
46
.package(url: "https://github.com/swiftlang/swift-docc-plugin", "1.0.0"..<"1.4.0")
40
47
)
41
48
EOF
42
- done
49
+ done
50
+ fi
43
51
44
52
log " Checking documentation targets..."
45
53
for target in $( yq -r ' .builder.configs[].documentation_targets[]' .spi.yml) ; do
You can’t perform that action at this time.
0 commit comments