Skip to content

Commit 21d63d4

Browse files
committed
enable push_preview
1 parent 5b5a602 commit 21d63d4

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
34
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
45

56
[compat]

docs/make.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Documenter
1+
using Documenter, JSON
22
using OffsetArrays
33

44
makedocs(
@@ -9,6 +9,17 @@ makedocs(
99
doctestfilters = [r"at \./.*", r"at /home.*", r"top-level scope.*", r"\[\d*\]\s*$"], # for backtraces
1010
)
1111

12+
# a workdaround to github action that only push preview when PR has "push_preview" labels
13+
# issue: https://github.com/JuliaDocs/Documenter.jl/issues/1225
14+
function should_push_preview(event_path = get(ENV, "GITHUB_EVENT_PATH", nothing))
15+
event_path === nothing && return false
16+
event = JSON.parsefile(event_path)
17+
haskey(event, "pull_request") || return false
18+
labels = [x["name"] for x in event["pull_request"]["labels"]]
19+
return "push_preview" in labels
20+
end
21+
1222
deploydocs(
13-
repo = "github.com:JuliaArrays/OffsetArrays.jl.git"
23+
repo = "github.com:JuliaArrays/OffsetArrays.jl.git",
24+
push_preview = should_push_preview()
1425
)

0 commit comments

Comments
 (0)