@@ -1521,7 +1521,7 @@ end
1521
1521
if Sys. which (" curl" ) === nothing
1522
1522
@warn " 'curl' binary not found, skipping related tests."
1523
1523
else
1524
- @testset " Default GitHubActions" begin
1524
+ @testset " Default GitHubActions push " begin
1525
1525
buffer = IOBuffer ()
1526
1526
logger = SimpleLogger (buffer, Logging. Debug)
1527
1527
with_logger (logger) do
@@ -1539,7 +1539,40 @@ end
1539
1539
end
1540
1540
end
1541
1541
logged = read (seek (buffer, 0 ), String)
1542
- @test occursin (""" `curl -sX POST -H 'Authorization: token SGVsbG8sIHdvcmxkLg==' -H 'User-Agent: Documenter.jl' -H 'Content-Type: application/json' -d '{"target_url":"https://JuliaDocs.github.io/Documenter.jl/","context":"documenter/deploy","description":"Documentation build succeeded","state":"success"}' badurl://api.github.com/repos/JuliaDocs/Documenter.jl/statuses/407d4b94`""" , logged)
1542
+ @test occursin (r""" `curl -sX POST -H 'Authorization: token SGVsbG8sIHdvcmxkLg==' -H 'User-Agent: Documenter.jl' -H 'Content-Type: application/json' -d '{.+?}' badurl://api.github.com/repos/JuliaDocs/Documenter.jl/statuses/407d4b94`""" , logged)
1543
+ @test occursin (r""" `.+?{.*?\" target_url":"https://JuliaDocs.github.io/Documenter.jl/".*?}'.+?`""" , logged)
1544
+ @test occursin (r""" `.+?{.*?\" context\" :\" documenter/deploy\" .*?}'.+?`""" , logged)
1545
+ @test occursin (r""" `.+?{.*?\" description\" :\" Documentation build succeeded\" .*?}'.+?`""" , logged)
1546
+ @test occursin (r""" `.+?{.*?\" state\" :\" success\" .*?}'.+?`""" , logged)
1547
+ end
1548
+
1549
+ @testset " Default GitHubActions pull_request" begin
1550
+ buffer = IOBuffer ()
1551
+ logger = SimpleLogger (buffer, Logging. Debug)
1552
+ with_logger (logger) do
1553
+ mktemp () do path, io
1554
+ write (io, """ {"pull_request":{"head":{"sha":"407d4b94"}}}""" )
1555
+ close (io)
1556
+ withenv (
1557
+ " GITHUB_EVENT_NAME" => " pull_request" ,
1558
+ " GITHUB_EVENT_PATH" => path,
1559
+ " GITHUB_REPOSITORY" => " JuliaDocs/Documenter.jl" ,
1560
+ " GITHUB_REF" => " refs/tags/v1.2.3" ,
1561
+ " GITHUB_ACTOR" => " github-actions" ,
1562
+ " GITHUB_TOKEN" => " SGVsbG8sIHdvcmxkLg==" ,
1563
+ " GITHUB_API_URL" => " badurl://api.github.com" # use bad url protocol to trigger CURL failure
1564
+ ) do
1565
+ cfg = Documenter. GitHubActions ()
1566
+ Documenter. post_status (cfg; type = " success" , repo = " github.com/JuliaDocs/Documenter.jl" )
1567
+ end
1568
+ end
1569
+ end
1570
+ logged = read (seek (buffer, 0 ), String)
1571
+ @test occursin (r""" `curl -sX POST -H 'Authorization: token SGVsbG8sIHdvcmxkLg==' -H 'User-Agent: Documenter.jl' -H 'Content-Type: application/json' -d '{.+?}' badurl://api.github.com/repos/JuliaDocs/Documenter.jl/statuses/407d4b94`""" , logged)
1572
+ @test occursin (r""" `.+?{.*?\" target_url":"https://JuliaDocs.github.io/Documenter.jl/".*?}'.+?`""" , logged)
1573
+ @test occursin (r""" `.+?{.*?\" context\" :\" documenter/deploy\" .*?}'.+?`""" , logged)
1574
+ @test occursin (r""" `.+?{.*?\" description\" :\" Documentation build succeeded\" .*?}'.+?`""" , logged)
1575
+ @test occursin (r""" `.+?{.*?\" state\" :\" success\" .*?}'.+?`""" , logged)
1543
1576
end
1544
1577
1545
1578
@testset " Self-hosted GitHubActions" begin
@@ -1555,12 +1588,17 @@ end
1555
1588
" GITHUB_TOKEN" => " SGVsbG8sIHdvcmxkLg==" ,
1556
1589
" GITHUB_API_URL" => " badurl://api.github.selfhosted" # use bad url protocol to trigger CURL failure
1557
1590
) do
1558
- cfg = Documenter. GitHubActions (" github.selfhosted" , " pages.selfhosted" )
1591
+ cfg = Documenter. GitHubActions (" github.selfhosted" , " pages.selfhosted/pages/JuliaDocs/Documenter.jl " )
1559
1592
Documenter. post_status (cfg; type = " success" , repo = " github.selfhosted/JuliaDocs/Documenter.jl" )
1560
1593
end
1561
1594
end
1562
1595
logged = read (seek (buffer, 0 ), String)
1563
- @test occursin (""" `curl -sX POST -H 'Authorization: token SGVsbG8sIHdvcmxkLg==' -H 'User-Agent: Documenter.jl' -H 'Content-Type: application/json' -d '{\" target_url\" :\" pages.selfhosted\" ,\" context\" :\" documenter/deploy\" ,\" description\" :\" Documentation build succeeded\" ,\" state\" :\" success\" }' badurl://api.github.selfhosted/repos/JuliaDocs/Documenter.jl/statuses/407d4b94`""" , logged)
1596
+ @test occursin (r""" `curl -sX POST -H 'Authorization: token SGVsbG8sIHdvcmxkLg==' -H 'User-Agent: Documenter.jl' -H 'Content-Type: application/json' -d '{.+?}' badurl://api.github.selfhosted/repos/JuliaDocs/Documenter.jl/statuses/407d4b94`""" , logged)
1597
+ @test occursin (r""" `.+?{.*?\" target_url\" :\" pages.selfhosted/pages/JuliaDocs/Documenter.jl\" .*?}'.+?`""" , logged)
1598
+ @test occursin (r""" `.+?{.*?\" context\" :\" documenter/deploy\" .*?}'.+?`""" , logged)
1599
+ @test occursin (r""" `.+?{.*?\" description\" :\" Documentation build succeeded\" .*?}'.+?`""" , logged)
1600
+ @test occursin (r""" `.+?{.*?\" state\" :\" success\" .*?}'.+?`""" , logged)
1601
+
1564
1602
end
1565
1603
1566
1604
end
0 commit comments