Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/adam-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
---
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
with:
cache: true

- 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("ADaM script execution complete.")

- 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: 14

- 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 }}
Loading