@@ -1516,3 +1516,52 @@ end
1516
1516
@test length (r. stdout ) > 0
1517
1517
end
1518
1518
end
1519
+
1520
+ @testset " post_status" begin
1521
+ if Sys. which (" curl" ) === nothing
1522
+ @warn " 'curl' binary not found, skipping related tests."
1523
+ else
1524
+ @testset " Default GitHubActions" begin
1525
+ buffer = IOBuffer ()
1526
+ logger = SimpleLogger (buffer, Logging. Debug)
1527
+ with_logger (logger) do
1528
+ withenv (
1529
+ " GITHUB_EVENT_NAME" => " push" ,
1530
+ " GITHUB_REPOSITORY" => " JuliaDocs/Documenter.jl" ,
1531
+ " GITHUB_REF" => " refs/tags/v1.2.3" ,
1532
+ " GITHUB_ACTOR" => " github-actions" ,
1533
+ " GITHUB_SHA" => " 407d4b94" ,
1534
+ " GITHUB_TOKEN" => " SGVsbG8sIHdvcmxkLg==" ,
1535
+ " GITHUB_API_URL" => " badurl://api.github.com" # use bad url protocol to trigger CURL failure
1536
+ ) do
1537
+ cfg = Documenter. GitHubActions ()
1538
+ Documenter. post_status (cfg; type = " success" , repo = " github.com/JuliaDocs/Documenter.jl" )
1539
+ end
1540
+ end
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)
1543
+ end
1544
+
1545
+ @testset " Self-hosted GitHubActions" begin
1546
+ buffer = IOBuffer ()
1547
+ logger = SimpleLogger (buffer, Logging. Debug)
1548
+ with_logger (logger) do
1549
+ withenv (
1550
+ " GITHUB_EVENT_NAME" => " push" ,
1551
+ " GITHUB_REPOSITORY" => " JuliaDocs/Documenter.jl" ,
1552
+ " GITHUB_REF" => " refs/tags/v1.2.3" ,
1553
+ " GITHUB_ACTOR" => " github-actions" ,
1554
+ " GITHUB_SHA" => " 407d4b94" ,
1555
+ " GITHUB_TOKEN" => " SGVsbG8sIHdvcmxkLg==" ,
1556
+ " GITHUB_API_URL" => " badurl://api.github.selfhosted" # use bad url protocol to trigger CURL failure
1557
+ ) do
1558
+ cfg = Documenter. GitHubActions (" github.selfhosted" , " pages.selfhosted" )
1559
+ Documenter. post_status (cfg; type = " success" , repo = " github.selfhosted/JuliaDocs/Documenter.jl" )
1560
+ end
1561
+ end
1562
+ 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)
1564
+ end
1565
+
1566
+ end
1567
+ end
0 commit comments