Skip to content
Merged
Show file tree
Hide file tree
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
26 changes: 22 additions & 4 deletions .github/workflows/approve-publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -333,7 +334,24 @@ 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 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)
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
Expand Down Expand Up @@ -404,7 +422,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." ;;
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/run-prescreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 != ''
Expand Down