From 2f0f7ea51969aee2a9d0ed2acaf153ca4d56607e Mon Sep 17 00:00:00 2001 From: HiranoMasaaki Date: Wed, 25 Feb 2026 14:08:27 +0000 Subject: [PATCH] fix: expert-cd workflow order and dynamic draft ID resolution MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove vars.EXPERT_DRAFT_ID_CREATE_EXPERT dependency - Resolve draft ID dynamically via `expert list --filter` - Fix step order: push draft → publish if private → assign version Co-Authored-By: Claude Opus 4.6 --- .github/workflows/expert-cd.yml | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/expert-cd.yml b/.github/workflows/expert-cd.yml index 1cabfc95..28ac6ea2 100644 --- a/.github/workflows/expert-cd.yml +++ b/.github/workflows/expert-cd.yml @@ -16,7 +16,6 @@ jobs: definition: - name: create-expert path: definitions/create-expert - draft-id: ${{ vars.EXPERT_DRAFT_ID_CREATE_EXPERT }} steps: - uses: actions/checkout@v6 @@ -45,28 +44,43 @@ jobs: echo "should-publish=true" >> "$GITHUB_OUTPUT" fi - - name: Publish scope if private + - name: Resolve draft ID if: steps.check.outputs.should-publish == 'true' + id: draft run: | - bun ./apps/perstack/bin/cli.ts expert publish ${{ matrix.definition.name }} \ - --api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }} || true + OUTPUT=$(bun ./apps/perstack/bin/cli.ts expert list --filter ${{ matrix.definition.name }} \ + --api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }}) + echo "$OUTPUT" + DRAFT_ID=$(echo "$OUTPUT" | grep "ID:" | head -1 | awk '{print $2}') + if [ -z "$DRAFT_ID" ]; then + echo "::error::Draft scope not found for ${{ matrix.definition.name }}" + exit 1 + fi + echo "draft-id=$DRAFT_ID" >> "$GITHUB_OUTPUT" + echo "Resolved draft ID: $DRAFT_ID" - name: Push to draft if: steps.check.outputs.should-publish == 'true' id: push run: | - OUTPUT=$(bun ./apps/perstack/bin/cli.ts expert push ${{ matrix.definition.draft-id }} \ + OUTPUT=$(bun ./apps/perstack/bin/cli.ts expert push ${{ steps.draft.outputs.draft-id }} \ --config ${{ matrix.definition.path }}/perstack.toml \ --api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }}) echo "$OUTPUT" REF_ID=$(echo "$OUTPUT" | grep "Ref ID:" | awk '{print $3}') echo "ref-id=$REF_ID" >> "$GITHUB_OUTPUT" + - name: Publish scope if private + if: steps.check.outputs.should-publish == 'true' + run: | + bun ./apps/perstack/bin/cli.ts expert publish ${{ matrix.definition.name }} \ + --api-key ${{ secrets.PERSTACK_PRODUCTION_API_KEY }} || true + - name: Assign version if: steps.check.outputs.should-publish == 'true' run: | bun ./apps/perstack/bin/cli.ts expert version \ - ${{ matrix.definition.draft-id }} \ + ${{ steps.draft.outputs.draft-id }} \ ${{ steps.push.outputs.ref-id }} \ ${{ steps.version.outputs.version }} \ --tag latest \