From acce384bc9a06d7befeb6af2b7454bac9cdf332c Mon Sep 17 00:00:00 2001 From: Seyed Yahya Shirazi Date: Wed, 18 Nov 2026 00:19:57 -0500 Subject: [PATCH 1/2] Approve via admin repo publish when the CLI has it --- .github/workflows/approve-publication.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/approve-publication.yml b/.github/workflows/approve-publication.yml index 6c6718e..fca61a5 100644 --- a/.github/workflows/approve-publication.yml +++ b/.github/workflows/approve-publication.yml @@ -25,7 +25,8 @@ name: Approve Publication # # What it does: validate the inputs, pick credentials for the environment, # check the key is an admin key before anything irreversible, run -# `nemar admin publish approve`, then read the request's final state back from +# `nemar admin repo publish approve` (`nemar admin publish approve` before CLI +# 0.10.34), then read the request's final state back from # the API and fail unless it is `published`. # # Why the final state is read back: the CLI exits 0 when an approval fails @@ -239,7 +240,7 @@ jobs: # goes through curl's config on stdin so the key is not on the command # line. # 2. The request this run was dispatched for is still the request the - # approval will act on. `nemar admin publish approve` picks the NEWEST + # approval will act on. `nemar admin repo publish approve` picks the NEWEST # active request for the dataset (requested, approving or blocked) when # it runs, not the one that was clicked. A run that waited in a queue # while an admin denied that request and the owner asked again would @@ -333,7 +334,21 @@ jobs: # prints "Cancelled" and exits 0. --skip-ci-check is never passed: an # admin override of BIDS validation is not something a button click # should carry. - args=(admin publish approve "$DATASET_ID" --yes) + # + # nemar-cli 0.10.34 moved the publication group under `admin repo` + # (`nemar admin repo publish approve`); the old `admin publish` path + # exits 1 there without running anything. Ask the installed CLI which + # one it has, so this works across the release whichever version npm + # serves. Captured, then matched in bash: `--help | grep -q` under + # pipefail can fail on the SIGPIPE grep's early exit sends the CLI. + repo_help="$(nemar admin repo --help 2>/dev/null || true)" + if [[ "$repo_help" == *"publish"* ]]; then + approve_cmd=(admin repo publish approve) + else + approve_cmd=(admin publish approve) + fi + echo "Using: nemar ${approve_cmd[*]}" + args=("${approve_cmd[@]}" "$DATASET_ID" --yes) if [ "$RESUME" = "true" ]; then args+=(--resume); fi # The dispatch token reaches the CLI here, in this step's own shell and @@ -404,7 +419,7 @@ jobs: # What to do depends on where the request stands, and "run it again" # is wrong for a request that needs a person. case "$final" in - approving) hint="It stopped partway. Run this workflow again with resume, or run: nemar admin publish approve ${DATASET_ID} --resume" ;; + approving) hint="It stopped partway. Run this workflow again with resume, or run: nemar admin repo publish approve ${DATASET_ID} --resume (before CLI 0.10.34: nemar admin publish approve)" ;; blocked) hint="The request is blocked: the owner has to fix it first (the reason is on the admin page)." ;; denied) hint="The request was denied; there is nothing to approve." ;; *) hint="The approval did not start. Read the approve step above, then dispatch it again from the admin page." ;; From adea24e3e1184f5ba8d5385ccc04f87e67d824f3 Mon Sep 17 00:00:00 2001 From: Seyed Yahya Shirazi Date: Wed, 18 Nov 2026 00:24:33 -0500 Subject: [PATCH 2/2] Match the publish command line, fix comments --- .github/workflows/approve-publication.yml | 9 ++++++--- .github/workflows/run-prescreen.yml | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/approve-publication.yml b/.github/workflows/approve-publication.yml index fca61a5..eda0fb2 100644 --- a/.github/workflows/approve-publication.yml +++ b/.github/workflows/approve-publication.yml @@ -340,9 +340,12 @@ jobs: # exits 1 there without running anything. Ask the installed CLI which # one it has, so this works across the release whichever version npm # serves. Captured, then matched in bash: `--help | grep -q` under - # pipefail can fail on the SIGPIPE grep's early exit sends the CLI. - repo_help="$(nemar admin repo --help 2>/dev/null || true)" - if [[ "$repo_help" == *"publish"* ]]; then + # pipefail can fail on the SIGPIPE that grep's early exit sends the CLI. + # The match is the `publish` command line itself (indented, whole word), + # not any mention of the word, so `unpublish` or a description cannot + # select a path the CLI does not have. Color codes are stripped first. + repo_help="$(nemar admin repo --help 2>/dev/null | sed 's/\x1b\[[0-9;]*m//g' || true)" + if [[ "$repo_help" =~ (^|$'\n')[[:space:]]+publish[[:space:]] ]]; then approve_cmd=(admin repo publish approve) else approve_cmd=(admin publish approve) diff --git a/.github/workflows/run-prescreen.yml b/.github/workflows/run-prescreen.yml index 07ef59c..9a4fb71 100644 --- a/.github/workflows/run-prescreen.yml +++ b/.github/workflows/run-prescreen.yml @@ -18,7 +18,8 @@ name: Run Pre-screen # The pre-screen is ADVISORY (nemarOrg/nemar-cli#756): it does NOT block # publication and no longer opens a GitHub issue on the dataset repo (that red # flag masked real BIDS/CI failures and admins overrode the block anyway). The -# concern + reasons surface in `nemar dataset/admin publish status`. +# concern + reasons surface in `nemar dataset publish status` and +# `nemar admin repo publish list` (`nemar admin publish list` before CLI 0.10.34). # # Lives on nemarDatasets/.github so its Actions minutes bill against the # dataset org's Team allowance (same accounting as the enrichment/manifest @@ -217,8 +218,9 @@ jobs: # "Block:" issue on the dataset repo (that red flag masked real BIDS/CI # failures and the block was overridden anyway). The reasons flow to the # Worker in the callback below and are recorded as a non-blocking advisory - # (prescreen_status='concern'), surfaced in `nemar dataset/admin publish - # status`. This also drops the NEMAR_GITHUB_PAT issue-write usage here. + # (prescreen_status='concern'), surfaced in `nemar dataset publish status` + # and `nemar admin repo publish list`. This also drops the NEMAR_GITHUB_PAT + # issue-write usage here. - name: Post verdict callback if: always() && steps.screen.outputs.verdict != ''