diff --git a/.github/workflows/test-auto-generate.yml b/.github/workflows/test-auto-generate.yml index fcfe5cf..c68299a 100644 --- a/.github/workflows/test-auto-generate.yml +++ b/.github/workflows/test-auto-generate.yml @@ -133,12 +133,18 @@ jobs: echo "📋 Generated files in test-${{ matrix.api_version }}/:" ls -la ./test-${{ matrix.api_version }}/ - - name: Upload artifacts + - name: Upload SDK artifacts uses: actions/upload-artifact@v4 with: name: test-generated-${{ matrix.api_version }} path: ./test-${{ matrix.api_version }} + - name: Upload config artifact (for version bump persistence) + uses: actions/upload-artifact@v4 + with: + name: test-config-${{ matrix.api_version }} + path: ${{ matrix.config_file }} + Process-and-Push: runs-on: ubuntu-latest needs: [Setup, Generate] @@ -157,6 +163,22 @@ jobs: with: path: ./test-generated + - name: Restore config files from artifacts + run: | + echo "📋 Restoring config files from artifacts..." + if [ -d "./test-generated/test-config-v20111101" ]; then + echo "📋 Restoring test-config-v20111101.yml" + cp ./test-generated/test-config-v20111101/* ./openapi/test-config-v20111101.yml 2>/dev/null || echo " (file not found in artifact)" + fi + if [ -d "./test-generated/test-config-v20250224" ]; then + echo "📋 Restoring test-config-v20250224.yml" + cp ./test-generated/test-config-v20250224/* ./openapi/test-config-v20250224.yml 2>/dev/null || echo " (file not found in artifact)" + fi + echo "📋 Config files after restoration:" + cat ./openapi/test-config-v20111101.yml 2>/dev/null || echo " test-config-v20111101.yml not available" + echo "---" + cat ./openapi/test-config-v20250224.yml 2>/dev/null || echo " test-config-v20250224.yml not available" + - name: Move generated files and track versions id: track_versions run: | @@ -213,9 +235,13 @@ jobs: cp CHANGELOG.md CHANGELOG.md.bak cp TEST-CHANGELOG.md CHANGELOG.md - VERSIONS_CSV=$(echo "$GENERATED_VERSIONS" | xargs | tr ' ' ',') - echo "📋 Updating TEST-CHANGELOG for versions: $VERSIONS_CSV" - ruby .github/changelog_manager.rb "$VERSIONS_CSV" + # *** ISSUE 2 FIX: Pass test directory names to changelog_manager.rb *** + # Instead of "v20111101", pass "test-v20111101" so changelog_manager reads from + # test-v20111101/package.json (version 98.1.0) not v20111101/package.json (version 2.0.0) + TEST_VERSIONS_CSV=$(echo "$GENERATED_VERSIONS" | xargs | sed 's/v20111101/test-v20111101/g' | sed 's/v20250224/test-v20250224/g' | tr ' ' ',') + echo "📋 Updating TEST-CHANGELOG for versions: $TEST_VERSIONS_CSV" + echo "📋 (directory names: converting api versions to test- prefixed directories)" + ruby .github/changelog_manager.rb "$TEST_VERSIONS_CSV" # Move updated changelog to TEST-CHANGELOG and restore real one cp CHANGELOG.md TEST-CHANGELOG.md @@ -261,6 +287,7 @@ jobs: with: token: ${{ steps.generate_token.outputs.token }} event-type: test_push_to_branch + client-payload: '{"versions": "${{ needs.Setup.outputs.versions_to_generate }}"}' - name: Summary run: | diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml index b4ad240..077c16f 100644 --- a/.github/workflows/test-on-push.yml +++ b/.github/workflows/test-on-push.yml @@ -39,22 +39,51 @@ jobs: echo "✅ No skip flag - proceeding with publish/release" fi - # Detect which test API versions were modified in this push + # Detect which test API versions were modified + # On repository_dispatch: versions come from client payload (paths-filter can't + # detect changes correctly because dispatch runs on master, not test-auto-generate) + # On push: use paths-filter as normal (push events have correct git context) + # NOTE: This is a SANDBOX-ONLY workaround. Production on-push-master.yml does NOT + # need this because both push and dispatch target master (same branch = correct context). detect-changes: runs-on: ubuntu-latest outputs: - test_v20111101: ${{ steps.filter.outputs.test_v20111101 }} - test_v20250224: ${{ steps.filter.outputs.test_v20250224 }} + test_v20111101: ${{ steps.result.outputs.test_v20111101 }} + test_v20250224: ${{ steps.result.outputs.test_v20250224 }} steps: - uses: actions/checkout@v3 - - uses: dorny/paths-filter@v2 + - name: Detect from dispatch payload + id: dispatch + if: github.event_name == 'repository_dispatch' + run: | + VERSIONS="${{ github.event.client_payload.versions }}" + echo "📋 Dispatch payload versions: $VERSIONS" + [[ "$VERSIONS" == *"v20111101"* ]] && echo "test_v20111101=true" >> $GITHUB_OUTPUT || echo "test_v20111101=false" >> $GITHUB_OUTPUT + [[ "$VERSIONS" == *"v20250224"* ]] && echo "test_v20250224=true" >> $GITHUB_OUTPUT || echo "test_v20250224=false" >> $GITHUB_OUTPUT + - name: Detect from push paths id: filter + if: github.event_name == 'push' + uses: dorny/paths-filter@v2 with: filters: | test_v20111101: - 'test-v20111101/**' test_v20250224: - 'test-v20250224/**' + - name: Set outputs + id: result + run: | + if [ "${{ github.event_name }}" = "repository_dispatch" ]; then + echo "test_v20111101=${{ steps.dispatch.outputs.test_v20111101 }}" >> $GITHUB_OUTPUT + echo "test_v20250224=${{ steps.dispatch.outputs.test_v20250224 }}" >> $GITHUB_OUTPUT + echo "📋 Using dispatch-based detection" + else + echo "test_v20111101=${{ steps.filter.outputs.test_v20111101 }}" >> $GITHUB_OUTPUT + echo "test_v20250224=${{ steps.filter.outputs.test_v20250224 }}" >> $GITHUB_OUTPUT + echo "📋 Using paths-filter-based detection" + fi + echo "📋 test_v20111101=${{ steps.dispatch.outputs.test_v20111101 || steps.filter.outputs.test_v20111101 }}" + echo "📋 test_v20250224=${{ steps.dispatch.outputs.test_v20250224 || steps.filter.outputs.test_v20250224 }}" # Simulated publish and release for each version conditionally # Same conditional structure as production but echoes success instead of real npm publish/GitHub release