From 9b8904f9cd4e265a88b5a2effb8d59531dc75be2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 13:00:25 +0000 Subject: [PATCH 1/4] Initial plan From 8b2b8ca4d013b4914f0ff9a6e09b515ac1cc6cc0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 13:03:58 +0000 Subject: [PATCH 2/4] Add PR docs preview deployment, comments, and cleanup workflow Agent-Logs-Url: https://github.com/multi-objective/moocore/sessions/f9c05a0c-d853-4fdc-83fa-5165964891f0 Co-authored-by: MLopez-Ibanez <2620021+MLopez-Ibanez@users.noreply.github.com> --- .github/workflows/R.yml | 43 +++++++++++++++++++++- .github/workflows/docs-preview-cleanup.yml | 34 +++++++++++++++++ .github/workflows/python.yml | 43 +++++++++++++++++++++- 3 files changed, 118 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docs-preview-cleanup.yml diff --git a/.github/workflows/R.yml b/.github/workflows/R.yml index 284c93df..aee83770 100644 --- a/.github/workflows/R.yml +++ b/.github/workflows/R.yml @@ -190,8 +190,9 @@ jobs: needs: R-CMD-check permissions: contents: write # github-pages-deploy-action + pull-requests: write # post PR preview comment concurrency: # Recommended if you intend to make multiple deployments in quick succession. - group: web-${{ github.workflow }}-${{ github.ref }} + group: web-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -233,6 +234,46 @@ jobs: single-commit: true clean: true + - name: Deploy PR preview šŸš€ + if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: r/docs + target-folder: previews/pr-${{ github.event.pull_request.number }}/r + single-commit: true + clean: true + + - name: Comment PR preview link + if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: actions/github-script@v7 + with: + script: | + const marker = ''; + const prNumber = context.issue.number; + const url = `https://multi-objective.github.io/moocore/previews/pr-${prNumber}/r/`; + const body = `${marker}\nšŸ“š **R docs preview** for this PR is available at:\n\n${url}`; + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + const existing = comments.data.find(c => c.body.includes(marker)); + if (existing) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existing.id, + body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body, + }); + } + rchk: needs: pkgdown uses: multi-objective/moocore/.github/workflows/rchk.yml@main diff --git a/.github/workflows/docs-preview-cleanup.yml b/.github/workflows/docs-preview-cleanup.yml new file mode 100644 index 00000000..5ad60598 --- /dev/null +++ b/.github/workflows/docs-preview-cleanup.yml @@ -0,0 +1,34 @@ +name: Cleanup docs preview + +on: + pull_request: + types: [closed] + +permissions: + contents: write + +jobs: + cleanup: + name: Remove docs preview for closed PR + runs-on: ubuntu-latest + # Only run for same-repo PRs; fork PRs never get a preview deployed + if: github.event.pull_request.head.repo.full_name == github.repository + steps: + - uses: actions/checkout@v6 + with: + ref: gh-pages + + - name: Remove preview folder + run: | + PR_NUMBER="${{ github.event.pull_request.number }}" + PREVIEW_DIR="previews/pr-${PR_NUMBER}" + if [ -d "${PREVIEW_DIR}" ]; then + git rm -rf "${PREVIEW_DIR}" + git config user.email "actions@github.com" + git config user.name "GitHub Actions" + git commit -m "Remove docs preview for PR #${PR_NUMBER}" + git push + echo "Removed ${PREVIEW_DIR}" + else + echo "No preview directory found for PR #${PR_NUMBER}, nothing to clean up" + fi diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 603dcc65..036cded2 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -117,8 +117,9 @@ jobs: if: "! contains(github.event.head_commit.message, '[skip ci]')" permissions: contents: write + pull-requests: write # post PR preview comment concurrency: # Recommended if you intend to make multiple deployments in quick succession. - group: web-${{ github.workflow }}-${{ github.ref }} + group: web-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} timeout-minutes: 10 runs-on: ubuntu-latest steps: @@ -165,6 +166,46 @@ jobs: single-commit: true clean: true + - name: Deploy PR preview šŸš€ + if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: JamesIves/github-pages-deploy-action@v4 + with: + folder: python/doc/_build/html/ + target-folder: previews/pr-${{ github.event.pull_request.number }}/python + single-commit: true + clean: true + + - name: Comment PR preview link + if: success() && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + uses: actions/github-script@v7 + with: + script: | + const marker = ''; + const prNumber = context.issue.number; + const url = `https://multi-objective.github.io/moocore/previews/pr-${prNumber}/python/`; + const body = `${marker}\nšŸ“š **Python docs preview** for this PR is available at:\n\n${url}`; + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + }); + const existing = comments.data.find(c => c.body.includes(marker)); + if (existing) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existing.id, + body, + }); + } else { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body, + }); + } + coverage: timeout-minutes: 15 needs: build-doc From d959a86ccf7348a804ae09c6a2a7bcbbe5811aa2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 13:36:26 +0000 Subject: [PATCH 3/4] Change Python docs preview comment to use inline link format Agent-Logs-Url: https://github.com/multi-objective/moocore/sessions/5cf05375-6419-4840-8e2f-9818784654ea Co-authored-by: MLopez-Ibanez <2620021+MLopez-Ibanez@users.noreply.github.com> --- .github/workflows/python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 036cded2..940cfcd9 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -183,7 +183,7 @@ jobs: const marker = ''; const prNumber = context.issue.number; const url = `https://multi-objective.github.io/moocore/previews/pr-${prNumber}/python/`; - const body = `${marker}\nšŸ“š **Python docs preview** for this PR is available at:\n\n${url}`; + const body = `${marker}\nšŸ“š [**Python docs preview** for this PR](${url})\n\n`; const comments = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo, From d0e0881ba2ad24f2cfb2303653f01a269be852ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 8 May 2026 13:40:33 +0000 Subject: [PATCH 4/4] Change R docs preview comment to use inline link format Agent-Logs-Url: https://github.com/multi-objective/moocore/sessions/880eae90-1d9e-4294-ba29-1dad881ab38a Co-authored-by: MLopez-Ibanez <2620021+MLopez-Ibanez@users.noreply.github.com> --- .github/workflows/R.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/R.yml b/.github/workflows/R.yml index aee83770..07e5eaf5 100644 --- a/.github/workflows/R.yml +++ b/.github/workflows/R.yml @@ -251,7 +251,7 @@ jobs: const marker = ''; const prNumber = context.issue.number; const url = `https://multi-objective.github.io/moocore/previews/pr-${prNumber}/r/`; - const body = `${marker}\nšŸ“š **R docs preview** for this PR is available at:\n\n${url}`; + const body = `${marker}\nšŸ“š [**R docs preview** for this PR](${url})\n\n`; const comments = await github.rest.issues.listComments({ owner: context.repo.owner, repo: context.repo.repo,