From a296e8dc922e30f52ed9be232e0c7a03aed5f16a Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 17:02:10 +0000 Subject: [PATCH] Update and rename doc-preview.yml to docs-preview.yml (#3601) (#3775) (cherry picked from commit f3daba864496baa30c07dbe7a4b2703d6af38d28) Co-authored-by: Brandon Morelli --- .github/workflows/doc-preview.yml | 28 ---------------------------- .github/workflows/docs-preview.yml | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/doc-preview.yml create mode 100644 .github/workflows/docs-preview.yml diff --git a/.github/workflows/doc-preview.yml b/.github/workflows/doc-preview.yml deleted file mode 100644 index 3a9a0bf5ac..0000000000 --- a/.github/workflows/doc-preview.yml +++ /dev/null @@ -1,28 +0,0 @@ -on: - pull_request_target: - types: [opened] - paths: - - '**.asciidoc' - - '**.jpg' - - '**.png' - - '**.gif' - -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 = `A documentation preview will be available soon: - - 📚 [HTML diff](https://${context.repo.repo}_${pr.number}.docs-preview.app.elstc.co/diff) - - 📙 [Observability Guide](https://${context.repo.repo}_${pr.number}.docs-preview.app.elstc.co/guide/en/observability/master/index.html)`; - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: comment, - }); diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml new file mode 100644 index 0000000000..8a197b9ad9 --- /dev/null +++ b/.github/workflows/docs-preview.yml @@ -0,0 +1,23 @@ +name: docs-preview +on: + pull_request_target: + types: [opened] + paths: + - '**.asciidoc' + - '**.jpg' + - '**.png' + - '**.gif' + +permissions: + pull-requests: write + +jobs: + doc-preview-pr: + runs-on: ubuntu-latest + steps: + - uses: elastic/docs/.github/actions/docs-preview@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + repo: ${{ github.event.repository.name }} + preview-path: 'guide/index.html' + pr: ${{ github.event.pull_request.number }}