From 64ec3fe579b50c78c97f25128b7850962be6ebb4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 6 Apr 2026 20:30:33 +0000 Subject: [PATCH 1/2] feat: add workflow to generate and upload ADaM XPT artifacts on PRs Agent-Logs-Url: https://github.com/pharmaverse/examples/sessions/b93c01ef-6701-4269-b271-186c34c1b22f Co-authored-by: bms63 <10111024+bms63@users.noreply.github.com> --- .github/workflows/adam-artifacts.yml | 97 ++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/adam-artifacts.yml diff --git a/.github/workflows/adam-artifacts.yml b/.github/workflows/adam-artifacts.yml new file mode 100644 index 00000000..698e0f2d --- /dev/null +++ b/.github/workflows/adam-artifacts.yml @@ -0,0 +1,97 @@ +--- +name: Generate ADaM Artifacts + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + branches: + - main + +permissions: + pull-requests: write + +jobs: + generate-artifacts: + name: Generate ADaM XPT files and Specs + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Setup R + uses: r-lib/actions/setup-r@v2 + + - name: Setup R Dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + + - name: Run ADaM R scripts + shell: Rscript {0} + run: | + # Run each ADaM script in order (ADSL first as other datasets may depend on it) + adam_scripts <- c( + "adam/adsl.R", + "adam/adae.R", + "adam/advs.R", + "adam/adrs.R", + "adam/adtte.R", + "adam/adpc.R", + "adam/adppk.R", + "adam/ader.R" + ) + + for (script in adam_scripts) { + message(sprintf("--- Running %s ---", script)) + tryCatch( + source(script, local = new.env(parent = globalenv())), + error = function(e) message(sprintf("ERROR in %s: %s", script, conditionMessage(e))) + ) + } + + message(sprintf("XPT files generated in: %s", tempdir())) + + - name: Collect XPT files and specs + run: | + mkdir -p adam_artifacts + + # Copy all XPT files generated by the ADaM scripts + find /tmp -name "*.xpt" -type f -exec cp -v {} adam_artifacts/ \; + + # Copy all spec files from metadata/ + cp -v metadata/*.xlsx adam_artifacts/ 2>/dev/null || true + cp -v metadata/*.csv adam_artifacts/ 2>/dev/null || true + + echo "" + echo "=== Artifact contents ===" + ls -lh adam_artifacts/ + + - name: Upload ADaM XPT files and specs + uses: actions/upload-artifact@v4 + with: + name: adam-xpt-and-specs + path: adam_artifacts/ + if-no-files-found: warn + retention-days: 30 + + - name: Post PR comment with artifact link + uses: marocchino/sticky-pull-request-comment@v2 + with: + header: "ADaM Artifacts" + message: | + ## ADaM XPT Files & Specs + + The ADaM XPT files and specification files have been generated and are available as a downloadable artifact. + + 📦 **[Download adam-xpt-and-specs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})** + + The artifact contains: + - All generated `.xpt` files (ADSL, ADAE, ADVS, ADRS, ADTTE, ADPC, ADPPK, ADER) + - Specification files from `metadata/` (`.xlsx`, `.csv`) + + > **Note:** Artifacts can be downloaded from the [Actions run page](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) under the *Artifacts* section at the bottom. + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} From fc23c2657c334888f3e2dd6a719a3247603b68cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 6 Apr 2026 20:31:22 +0000 Subject: [PATCH 2/2] fix: address review feedback - fix message, add cache, reduce retention Agent-Logs-Url: https://github.com/pharmaverse/examples/sessions/b93c01ef-6701-4269-b271-186c34c1b22f Co-authored-by: bms63 <10111024+bms63@users.noreply.github.com> --- .github/workflows/adam-artifacts.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/adam-artifacts.yml b/.github/workflows/adam-artifacts.yml index 698e0f2d..a718d995 100644 --- a/.github/workflows/adam-artifacts.yml +++ b/.github/workflows/adam-artifacts.yml @@ -28,6 +28,8 @@ jobs: - name: Setup R Dependencies uses: r-lib/actions/setup-r-dependencies@v2 + with: + cache: true - name: Run ADaM R scripts shell: Rscript {0} @@ -52,7 +54,7 @@ jobs: ) } - message(sprintf("XPT files generated in: %s", tempdir())) + message("ADaM script execution complete.") - name: Collect XPT files and specs run: | @@ -75,7 +77,7 @@ jobs: name: adam-xpt-and-specs path: adam_artifacts/ if-no-files-found: warn - retention-days: 30 + retention-days: 14 - name: Post PR comment with artifact link uses: marocchino/sticky-pull-request-comment@v2