From 572ef332102932977e1d00f857bc663a9986d9a5 Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 15 Oct 2019 01:23:46 +0200 Subject: [PATCH] test comment --- .github/workflows/docs.yml | 1 + docs/make.jl | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index ceb1a2b..d272a74 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,4 +20,5 @@ jobs: - name: Build and deploy env: DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: julia --project=docs --color=yes docs/make.jl diff --git a/docs/make.jl b/docs/make.jl index f744aec..bb99c0b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -81,6 +81,18 @@ if get(ENV, "GITHUB_EVENT_NAME", nothing) == "pull_request" devurl = "preview-PR$(PR)", repo = "github.com/fredrikekre/Literate.jl.git", ) + # Add a comment on the PR with a link to the preview + # TODO: URL available from JSON.parsefile(ENV["GITHUB..."])["pull_request"]["comments_url"] + msg = "Documentation built successfully, a preview can be found here: https://fredrikekre.github.io/Literate.jl/preview-PR$(PR)" + cmd = `curl -X POST` + push!(cmd.exec, "-H", "Authorization: token $(ENV["GITHUB_TOKEN"])") + push!(cmd.exec, "-H", "Content-Type: application/json") + push!(cmd.exec, "-d", "'{\"body\":\"$(msg)\"}'") + push!(cmd.exec, "https://api.github.com/repos/fredrikekre/Literate.jl/issues/$(PR)/comments") + try + success(cmd) + catch + end exit(0) end