From 41890c661e06558972256458611957c20c4d5ced Mon Sep 17 00:00:00 2001 From: Joe Peeples Date: Wed, 31 Aug 2022 16:44:07 -0400 Subject: [PATCH] Adds GitHub action to create preview links (#2391) (#2424) (cherry picked from commit 7373755c31b89e903da43a1a4dd7603569a1cb14) --- .github/workflows/docs-preview-links.yml | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/docs-preview-links.yml diff --git a/.github/workflows/docs-preview-links.yml b/.github/workflows/docs-preview-links.yml new file mode 100644 index 0000000000..03711cfa6b --- /dev/null +++ b/.github/workflows/docs-preview-links.yml @@ -0,0 +1,25 @@ +name: Docs Preview Links + +on: + pull_request_target: + types: [opened] + +jobs: + doc-preview: + runs-on: ubuntu-latest + steps: + - uses: actions/github-script@v6 + name: Add doc preview links + with: + script: | + const pr = context.payload.pull_request; + const comment = `Documentation previews: + - ✨ [HTML diff](https://${context.repo.repo}_${pr.number}.docs-preview.app.elstc.co/diff) + - 📙 [Elastic Security Guide](https://${context.repo.repo}_${pr.number}.docs-preview.app.elstc.co/guide/en/security/master/index.html)`; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: comment, + });