Skip to content

Commit 1c463fd

Browse files
authored
Clarify check-docs.sh early-exit
In the event that there is no `.spi.yml` file, the script currently exits messily: ``` ** Editing Package.swift... ** Checking documentation targets... usage: yq [-h] [--yaml-output] [--yaml-roundtrip] [--yaml-output-grammar-version {1.1,1.2}] [--width WIDTH] [--indentless-lists] [--in-place] [--version] [jq_filter] [files ...] yq: error: argument files: can't open '.spi.yml': [Errno 2] No such file or directory: '.spi.yml' ** ✅ Found no documentation issues. ``` Not having an `.spi.yml` file is perfectly valid if the repository has no defined documentation targets. This change results in the following behavior: ``` ** No '.spi.yml' found, no documentation targets to check. ```
1 parent 3fca720 commit 1c463fd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

.github/workflows/scripts/check-docs.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ log() { printf -- "** %s\n" "$*" >&2; }
1717
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
1818
fatal() { error "$@"; exit 1; }
1919

20+
if [ ! -f .spi.yml ]; then
21+
log "No '.spi.yml' found, no documentation targets to check."
22+
exit 0
23+
fi
24+
2025
log "Editing Package.swift..."
2126
cat <<EOF >> "Package.swift"
2227
package.dependencies.append(

0 commit comments

Comments
 (0)