Skip to content

Commit c203826

Browse files
committed
Allow httpdocs-path that doesn't end in /reference
Closes gh-20
1 parent 90f0064 commit c203826

File tree

3 files changed

+11
-31
lines changed

3 files changed

+11
-31
lines changed

Diff for: rsync-antora-reference/src/check_github_repository_owner.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ __check_github_repository_owner() {
4646
if ! [[ "$github_repository" =~ .+/.+ ]]; then
4747
__check_github_repository_owner_usage_error " '--github-repository' must be in the form of <owner>/<name> but got '$github_repository'"
4848
fi
49-
if ! [[ "$ssh_docs_path" =~ /.+/reference ]]; then
50-
__check_github_repository_owner_usage_error " '--ssh-docs-path' must start with / and end with /reference but got '$ssh_docs_path'"
49+
if ! [[ "$ssh_docs_path" =~ ^/.+ ]]; then
50+
__check_github_repository_owner_usage_error " '--ssh-docs-path' must start with and not equal / but got '$ssh_docs_path'"
5151
fi
5252

5353
local marker_file="${ssh_docs_path}/.github-repository"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
spring-projects/spring-security

Diff for: rsync-antora-reference/test/test-check_github_repository_owner.bats

+8-29
Original file line numberDiff line numberDiff line change
@@ -50,44 +50,23 @@ usage: check_github_repository_owner.sh [OPTION]...
5050
@test "missing ssh-docs-path" {
5151
run check_github_repository_owner.sh --github-repository spring-projects/spring-security
5252
assert [ "$status" -eq 1 ]
53-
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with / and end with /reference but got ''" ]
53+
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with and not equal / but got ''" ]
5454
assert [ "${lines[1]}" = 'usage: check_github_repository_owner.sh [OPTION]...' ]
5555
}
5656

5757
@test "invalid ssh-docs-path spring-security/reference" {
5858
run check_github_repository_owner.sh --github-repository spring-projects/spring-security --ssh-docs-path spring-security/reference
5959
assert [ "$status" -eq 1 ]
60-
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with / and end with /reference but got 'spring-security/reference'" ]
60+
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with and not equal / but got 'spring-security/reference'" ]
6161
assert [ "${lines[1]}" = 'usage: check_github_repository_owner.sh [OPTION]...' ]
6262
}
6363

64-
@test "invalid ssh-docs-path /reference" {
65-
run check_github_repository_owner.sh --github-repository spring-projects/spring-security --ssh-docs-path /reference
66-
assert [ "$status" -eq 1 ]
67-
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with / and end with /reference but got '/reference'" ]
68-
assert [ "${lines[1]}" = 'usage: check_github_repository_owner.sh [OPTION]...' ]
69-
}
70-
71-
@test "invalid ssh-docs-path //reference" {
72-
run check_github_repository_owner.sh --github-repository spring-projects/spring-security --ssh-docs-path //reference
73-
assert [ "$status" -eq 1 ]
74-
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with / and end with /reference but got '//reference'" ]
75-
assert [ "${lines[1]}" = 'usage: check_github_repository_owner.sh [OPTION]...' ]
76-
}
77-
78-
79-
@test "invalid ssh-docs-path /spring-securityreference" {
80-
run check_github_repository_owner.sh --github-repository spring-projects/spring-security --ssh-docs-path /spring-securityreference
81-
assert [ "$status" -eq 1 ]
82-
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with / and end with /reference but got '/spring-securityreference'" ]
83-
assert [ "${lines[1]}" = 'usage: check_github_repository_owner.sh [OPTION]...' ]
84-
}
85-
86-
@test "invalid ssh-docs-path /spring-security" {
87-
run check_github_repository_owner.sh --github-repository spring-projects/spring-security --ssh-docs-path /spring-security
88-
assert [ "$status" -eq 1 ]
89-
assert [ "${lines[0]}" = "Error: '--ssh-docs-path' must start with / and end with /reference but got '/spring-security'" ]
90-
assert [ "${lines[1]}" = 'usage: check_github_repository_owner.sh [OPTION]...' ]
64+
# https://github.com/spring-io/spring-doc-actions/issues/20
65+
@test "Allow httpdocs-path that does not end in /reference" {
66+
local dir="${BATS_RESOURCE_TEMP_DIR}/antora"
67+
run check_github_repository_owner.sh --github-repository spring-projects/spring-security --ssh-docs-path "$dir"
68+
assert_success
69+
assert_output "Owner is verified"
9170
}
9271

9372
@test "existing project with valid marker file" {

0 commit comments

Comments
 (0)