From 07541fc6d500af556a2e367ff01cefd72edd5a46 Mon Sep 17 00:00:00 2001 From: Milo Banks Date: Fri, 22 Nov 2024 13:22:25 -0700 Subject: [PATCH] Post Artifact as Comment (#61) * [58] implement * [gha] fix artifact name * [gha] give sphinx action permissions * [gha] segregate into distinct jobs * Update sphinx.yaml --------- Co-authored-by: George G. Vega Yon --- .github/workflows/sphinx.yaml | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sphinx.yaml b/.github/workflows/sphinx.yaml index 6eaf20b..dc8d835 100644 --- a/.github/workflows/sphinx.yaml +++ b/.github/workflows/sphinx.yaml @@ -11,9 +11,8 @@ on: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: - contents: read - pages: write - id-token: write + actions: read + pull-requests: write jobs: build: @@ -59,12 +58,30 @@ jobs: run: mv README_files docs/build/html # Upload - - name: Upload artifacts + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: name: github-pages path: docs/build/html/ + post-page-artifact: + if: ${{ github.event_name == 'pull_request' }} + needs: build + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Post comment preview + uses: CDCgov/cfa-actions/post-artifact@v1.0.0 + with: + artifact-name: github-pages + gh-token: ${{ secrets.GITHUB_TOKEN}} + message: "Thanks for your contribution, ${{ github.actor }}; your `{ artifact-name }` is ready for download [here]({ artifact-url })." + deploy: # Deploy to the github-pages environment # but not on PRs