From 29ed17bbbfb322f1c8fbd9e90fc2aae47600aff9 Mon Sep 17 00:00:00 2001 From: AnneCYH Date: Tue, 11 Mar 2025 14:48:43 +0800 Subject: [PATCH 1/2] docs: add GHA with comment to docs build Signed-off-by: AnneCYH --- .github/add-docs-link.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/add-docs-link.yaml diff --git a/.github/add-docs-link.yaml b/.github/add-docs-link.yaml new file mode 100644 index 0000000..4a51a70 --- /dev/null +++ b/.github/add-docs-link.yaml @@ -0,0 +1,25 @@ +name: Add PR comment + +on: + pull_request: + types: + - opened + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - name: Add PR comment with doc link + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prNumber = context.payload.pull_request.number; + const commentBody = `Link to docs build: https://canonical-kteam-docs--${prNumber}.com.readthedocs.build/en/${prNumber}/`; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: commentBody + }); From 88e47330c77aa36bcc2a3bad3ff968f053819bdc Mon Sep 17 00:00:00 2001 From: AnneCYH Date: Tue, 11 Mar 2025 14:51:52 +0800 Subject: [PATCH 2/2] Create add-docs-link-comment.yml Signed-off-by: AnneCYH --- .github/workflows/add-docs-link-comment.yml | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/add-docs-link-comment.yml diff --git a/.github/workflows/add-docs-link-comment.yml b/.github/workflows/add-docs-link-comment.yml new file mode 100644 index 0000000..4a51a70 --- /dev/null +++ b/.github/workflows/add-docs-link-comment.yml @@ -0,0 +1,25 @@ +name: Add PR comment + +on: + pull_request: + types: + - opened + +jobs: + comment: + runs-on: ubuntu-latest + steps: + - name: Add PR comment with doc link + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prNumber = context.payload.pull_request.number; + const commentBody = `Link to docs build: https://canonical-kteam-docs--${prNumber}.com.readthedocs.build/en/${prNumber}/`; + + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: commentBody + });