diff --git a/.github/workflows/publish-lab-env.yml b/.github/workflows/publish-lab-env.yml index 981cddad..7eca7315 100644 --- a/.github/workflows/publish-lab-env.yml +++ b/.github/workflows/publish-lab-env.yml @@ -9,8 +9,9 @@ name: Publish qBraid Lab environment # variable QBRAID_ENV_LOGO_URL https URL of a PNG logo (optional; overrides the # pyqasm light and dark logos in bin/publish_lab_env.py) # The steps live in bin/publish_lab_env.py and bin/lab_env_smoke_test.py. -# The run approves directly, without a publish request. That skips the per-plan -# publish quota and the email a request sends every platform admin. +# The run files a publish request and then approves it, because the server +# approves only an environment with an open request. The request counts toward +# the key owner's per-plan publish quota and notifies the platform admins. on: workflow_dispatch: diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a64f510..b9c7fbd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ Types of changes: ### Removed ### Fixed +- `publish-lab-env.yml` files a publish request before it approves the environment. Since qBraid/qbraid-api#1334 the server approves only an environment with an open request, so every run failed at approve with `Environment must have status REQUESTED or PENDING to publish`. The request counts toward the API key owner's publish quota and notifies the platform admins ([#491](https://github.com/qBraid/pyqasm/pull/491), [#490](https://github.com/qBraid/pyqasm/issues/490)). ### Dependencies diff --git a/bin/publish_lab_env.py b/bin/publish_lab_env.py index 26b3c6b6..cf625fb3 100644 --- a/bin/publish_lab_env.py +++ b/bin/publish_lab_env.py @@ -318,7 +318,7 @@ def should_set_latest(client: Any, settings: Settings, current: Optional[str], s def publish(settings: Settings, slug: str) -> None: - """Approve, then add to the group as its latest. Skips steps already done.""" + """Request and approve, then add to the group as its latest. Skips steps already done.""" steps = PUBLISH_STEPS[: PUBLISH_STEPS.index(settings.stop_after) + 1] group = settings.group if "publish" in steps and not group: @@ -330,9 +330,11 @@ def publish(settings: Settings, slug: str) -> None: if status == "APPROVED": print(f"'{slug}' is already approved.") else: - # Approve works from any status. Skipping the publish request avoids the - # per-plan publish quota and the email that a request sends every admin. - # Approving is what publishes to the catalog: it makes the environment public. + # The server approves only an environment with an open request, so file one + # first. A request counts toward the owner's per-plan publish quota and + # notifies the platform admins. Approving is what makes the environment public. + if status not in ("REQUESTED", "PENDING"): + client.request_publish(slug) client.approve_publish(slug) status = review_status(client, slug) if status != "APPROVED":