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
31 changes: 27 additions & 4 deletions .github/scripts/build_publish_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,31 @@ def _normalize_registry_trigger(trigger: dict[str, Any]) -> dict[str, Any]:
}


def _match_worker(workers: list[dict[str, Any]], worker_name: str) -> dict[str, Any]:
by_name = [w for w in workers if w.get("name") == worker_name or w.get("id") == worker_name]
if len(by_name) == 1:
return by_name[0]

namespace = worker_name.replace("-", "_")
by_namespace = [
w
for w in workers
if any(
isinstance(fid, str) and fid.startswith(f"{namespace}::")
for fid in (w.get("functions") or [])
)
]
if len(by_namespace) == 1:
return by_namespace[0]

summary = [{"id": w.get("id"), "name": w.get("name")} for w in workers]
raise ValueError(
f"could not match worker {worker_name!r}: "
f"{len(by_name)} by name/id, {len(by_namespace)} by namespace {namespace!r}, "
f"workers={summary}"
)


def normalize_worker_interface(
*,
worker_name: str,
Expand All @@ -134,11 +159,9 @@ def normalize_worker_interface(
triggers_json: dict[str, Any] | None = None,
) -> dict[str, list[dict[str, Any]]]:
workers = _extract_array(workers_json, "workers")
matches = [w for w in workers if w.get("name") == worker_name or w.get("id") == worker_name]
if len(matches) != 1:
raise ValueError(f"expected exactly one worker matching {worker_name!r}, found {len(matches)}")
worker = _match_worker(workers, worker_name)

worker_function_ids = matches[0].get("functions") or []
worker_function_ids = worker.get("functions") or []
if not isinstance(worker_function_ids, list):
raise ValueError("worker `functions` must be an array")

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_publish-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ jobs:

- name: Install iii CLI
env:
VERSION: '0.11.5'
VERSION: '0.11.6-next.1'
run: |
set -euo pipefail
curl -fsSL https://install.iii.dev/iii/main/install.sh -o /tmp/install-iii.sh
sh /tmp/install-iii.sh
sh /tmp/install-iii.sh --next
{
echo "$HOME/.local/bin"
echo "$HOME/.iii/bin"
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ jobs:
fetch-depth: 0
fetch-tags: true

- name: Refetch annotated tag
env:
RAW_TAG: ${{ inputs.tag || github.ref_name }}
run: |
set -euo pipefail
if [[ -n "$RAW_TAG" ]]; then
git fetch origin "+refs/tags/${RAW_TAG}:refs/tags/${RAW_TAG}"
fi

- name: Install pyyaml
run: pip install --quiet pyyaml

Expand Down
Loading