diff --git a/.github/workflows/test-auto-generate.yml b/.github/workflows/test-auto-generate.yml deleted file mode 100644 index 1e20f91..0000000 --- a/.github/workflows/test-auto-generate.yml +++ /dev/null @@ -1,303 +0,0 @@ -name: "TEST: Auto Generate and Push" - -# ============================================================================ -# SANDBOX TEST WORKFLOW - Phase 8A -# Mirrors openapi-generate-and-push.yml but uses test configs, test directories, -# and pushes to a test branch. Incorporates fixes for Issues 2, 5, and 6. -# DELETE THIS FILE after Phase 8A testing is complete. -# ============================================================================ - -on: - workflow_dispatch: - inputs: - payload_json: - description: 'JSON payload (e.g., {"api_versions":"v20111101","version":"minor","commit_sha":"abc123"})' - required: true - type: string - -jobs: - Setup: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - versions_to_generate: ${{ steps.parse-payload.outputs.versions_to_generate }} - steps: - - name: Parse payload - id: parse-payload - run: | - echo "📋 Raw payload: ${{ github.event.inputs.payload_json }}" - VERSIONS=$(echo '${{ github.event.inputs.payload_json }}' | jq -r '.api_versions // "v20111101"') - echo "📋 Parsed versions: $VERSIONS" - echo "versions_to_generate=$VERSIONS" >> $GITHUB_OUTPUT - - - name: Set up matrix - id: set-matrix - run: | - VERSIONS="${{ steps.parse-payload.outputs.versions_to_generate }}" - echo "📋 Versions to generate: $VERSIONS" - - # Build matrix JSON — uses TEST config files - MATRIX_JSON='{"include":[' - FIRST=true - - for VERSION in $(echo $VERSIONS | tr ',' ' '); do - if [ "$FIRST" = false ]; then - MATRIX_JSON+=',' - fi - FIRST=false - - # Map version to TEST config file (not production configs) - if [ "$VERSION" = "v20111101" ]; then - CONFIG="openapi/test-config-v20111101.yml" - elif [ "$VERSION" = "v20250224" ]; then - CONFIG="openapi/test-config-v20250224.yml" - fi - - MATRIX_JSON+="{\"api_version\":\"$VERSION\",\"config_file\":\"$CONFIG\"}" - done - - MATRIX_JSON+=']}' - echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT - echo "📋 Matrix: $MATRIX_JSON" - - Generate: - runs-on: ubuntu-latest - needs: Setup - strategy: - matrix: ${{ fromJson(needs.Setup.outputs.matrix) }} - fail-fast: false - steps: - - uses: actions/checkout@v3 - with: - ref: test-auto-generate - - uses: actions/setup-node@v3 - with: - node-version: "20" - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.1 - - - name: Validate configuration - run: | - # Skip config_validator.rb for test configs since it validates major version - # against SUPPORTED_VERSIONS map (98/99 would fail). Just validate file exists. - echo "📋 Validating test config: ${{ matrix.config_file }}" - if [ ! -f "${{ matrix.config_file }}" ]; then - echo "❌ Config file not found: ${{ matrix.config_file }}" - exit 1 - fi - echo "✅ Config file exists" - cat "${{ matrix.config_file }}" - - - name: Bump version - id: bump_version - run: | - # Parse version bump type from payload - VERSION=$(echo '${{ github.event.inputs.payload_json }}' | jq -r '.version // "patch"') - echo "📋 VERSION parsed as: $VERSION" - - # *** ISSUE 2 FIX: $VERSION unquoted (was "$VERSION" in production) *** - NEW_VERSION=$(ruby .github/version.rb $VERSION ${{ matrix.config_file }}) - echo "📋 NEW_VERSION returned: $NEW_VERSION" - echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT - - # Verify the config was actually updated - echo "📋 Config file after bump:" - cat ${{ matrix.config_file }} - - - name: Clean test directory - run: | - # Use clean.rb with test- prefix directory - ruby .github/clean.rb test-${{ matrix.api_version }} - - - name: Copy generator ignore rules - run: | - mkdir -p ./test-${{ matrix.api_version }}/ - cp .openapi-generator-ignore ./test-${{ matrix.api_version }}/ - - - name: Install openapi-generator-cli - run: npm install @openapitools/openapi-generator-cli -g - - - name: Generate SDK - run: | - # Parse commit_sha from payload - COMMIT_SHA=$(echo '${{ github.event.inputs.payload_json }}' | jq -r '.commit_sha // "master"') - echo "📋 Using commit SHA: $COMMIT_SHA" - - # Generate into test- prefixed directory - openapi-generator-cli generate \ - -i https://raw.githubusercontent.com/mxenabled/openapi/$COMMIT_SHA/openapi/${{ matrix.api_version }}.yml \ - -g typescript-axios \ - -c ${{ matrix.config_file }} \ - -t ./openapi/templates \ - -o ./test-${{ matrix.api_version }} - - echo "📋 Generated files in test-${{ matrix.api_version }}/:" - ls -la ./test-${{ matrix.api_version }}/ - - - 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] - steps: - - uses: actions/checkout@v3 - with: - ref: test-auto-generate - fetch-depth: 0 - - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.1 - - - name: Download all artifacts - uses: actions/download-artifact@v4 - 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" - - # Clean up config artifact directories so they don't get committed - rm -rf ./test-generated/test-config-v20111101 ./test-generated/test-config-v20250224 - echo "📋 Cleaned up config artifact directories" - - - name: Move generated files and track versions - id: track_versions - run: | - echo "📋 Downloaded artifacts:" - ls -la ./test-generated/ - - GENERATED_VERSIONS="" - - for dir in ./test-generated/test-generated-*; do - VERSION=$(basename "$dir" | sed 's/test-generated-//') - TARGET_DIR="./test-$VERSION" - - echo "📋 Processing: $dir → $TARGET_DIR" - echo "📋 Target directory exists? $([ -d "$TARGET_DIR" ] && echo 'YES' || echo 'NO')" - - # *** ISSUE 5 FIX: Remove target directory before moving *** - # Without this, mv places the source INSIDE the existing directory - # as a subdirectory instead of replacing its contents - if [ -d "$TARGET_DIR" ]; then - echo "📋 Removing existing target: $TARGET_DIR" - rm -rf "$TARGET_DIR" - fi - - mv "$dir" "$TARGET_DIR" - GENERATED_VERSIONS="$GENERATED_VERSIONS $VERSION" - - echo "📋 Files now in $TARGET_DIR:" - ls -la "$TARGET_DIR/" - - # Verify no nested subdirectory was created (Issue 5 validation) - if [ -d "$TARGET_DIR/test-generated-$VERSION" ]; then - echo "❌ ISSUE 5 NOT FIXED: Found nested subdirectory $TARGET_DIR/test-generated-$VERSION" - exit 1 - else - echo "✅ ISSUE 5 VALIDATED: No nested subdirectory created" - fi - done - - echo "generated_versions=$GENERATED_VERSIONS" >> $GITHUB_OUTPUT - echo "📋 All generated versions: $GENERATED_VERSIONS" - - - name: Update TEST-CHANGELOG - run: | - GENERATED_VERSIONS="${{ steps.track_versions.outputs.generated_versions }}" - - if [ -z "$GENERATED_VERSIONS" ]; then - echo "No versions generated, skipping changelog update" - exit 0 - fi - - # Use changelog_manager.rb pointed at TEST-CHANGELOG.md - # Pass real version names so changelog_manager validates and runs - # exactly like production. It reads from the real v20111101/package.json - # (not test-v20111101/) — the version number won't match the test config, - # but the workflow mechanics are what we're validating here. - 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" - - cp CHANGELOG.md TEST-CHANGELOG.md - mv CHANGELOG.md.bak CHANGELOG.md - - echo "📋 TEST-CHANGELOG.md after update:" - head -30 TEST-CHANGELOG.md - - - name: Copy documentation to test directories - run: | - GENERATED_VERSIONS="${{ steps.track_versions.outputs.generated_versions }}" - - for VERSION in $GENERATED_VERSIONS; do - cp LICENSE "./test-$VERSION/LICENSE" - cp TEST-CHANGELOG.md "./test-$VERSION/CHANGELOG.md" - cp MIGRATION.md "./test-$VERSION/MIGRATION.md" - done - - - name: Create commit and push to test branch - run: | - git config user.name "devexperience" - git config user.email "devexperience@mx.com" - git add . - git status - git commit -m "TEST: Generated SDK versions: ${{ needs.Setup.outputs.versions_to_generate }} - - This commit was automatically created by the test-auto-generate workflow. - Payload: ${{ github.event.inputs.payload_json }}" - git push origin test-auto-generate - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Generate access token - id: generate_token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.PAPI_SDK_APP_ID }} - installation_id: ${{ secrets.PAPI_SDK_INSTALLATION_ID }} - private_key: ${{ secrets.PAPI_SDK_PRIVATE_KEY }} - - - name: Trigger test-on-push workflow - uses: peter-evans/repository-dispatch@v2 - 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: | - echo "============================================" - echo "📋 TEST AUTO-GENERATE SUMMARY" - echo "============================================" - echo "Versions generated: ${{ needs.Setup.outputs.versions_to_generate }}" - echo "Pushed to branch: test-auto-generate" - echo "Triggered: test-on-push workflow via repository_dispatch" - echo "============================================" diff --git a/.github/workflows/test-on-push.yml b/.github/workflows/test-on-push.yml deleted file mode 100644 index 077c16f..0000000 --- a/.github/workflows/test-on-push.yml +++ /dev/null @@ -1,169 +0,0 @@ -name: "TEST: On Push to Test Branch" - -# ============================================================================ -# SANDBOX TEST WORKFLOW - Phase 8A -# Mirrors on-push-master.yml but tracks test-auto-generate branch and test -# directories. Publish/release jobs echo success instead of real actions. -# Incorporates fix for Issue 6 (env block for commit message). -# DELETE THIS FILE after Phase 8A testing is complete. -# ============================================================================ - -on: - push: - branches: [test-auto-generate] - paths: - - 'test-v20111101/**' - - 'test-v20250224/**' - repository_dispatch: - types: [test_push_to_branch] - -jobs: - # Check for skip-publish flag in commit message - # *** ISSUE 6 FIX: Uses env block instead of inline interpolation *** - check-skip-publish: - runs-on: ubuntu-latest - outputs: - skip_publish: ${{ steps.check.outputs.skip_publish }} - steps: - - name: Check for [skip-publish] flag in commit message - id: check - env: - COMMIT_MSG: ${{ github.event.head_commit.message }} - run: | - echo "📋 Commit message: $COMMIT_MSG" - if [[ "$COMMIT_MSG" == *"[skip-publish]"* ]]; then - echo "skip_publish=true" >> $GITHUB_OUTPUT - echo "🚫 [skip-publish] flag detected - skipping all publish/release jobs" - else - echo "skip_publish=false" >> $GITHUB_OUTPUT - echo "✅ No skip flag - proceeding with publish/release" - fi - - # 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.result.outputs.test_v20111101 }} - test_v20250224: ${{ steps.result.outputs.test_v20250224 }} - steps: - - uses: actions/checkout@v3 - - 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 - - publish-test-v20111101: - needs: [check-skip-publish, detect-changes] - if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20111101 == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: test-auto-generate - - name: Simulate publish - run: | - VERSION=$(jq -r '.version' ./test-v20111101/package.json) - echo "============================================" - echo "✅ PUBLISH SUCCESS (simulated)" - echo " Package: mx-platform-node@$VERSION" - echo " Directory: test-v20111101/" - echo " Would run: npm publish from test-v20111101/" - echo "============================================" - - release-test-v20111101: - needs: [check-skip-publish, detect-changes, publish-test-v20111101] - if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20111101 == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: test-auto-generate - - name: Simulate release - run: | - VERSION=$(jq -r '.version' ./test-v20111101/package.json) - echo "============================================" - echo "✅ RELEASE SUCCESS (simulated)" - echo " Tag: v$VERSION" - echo " Directory: test-v20111101/" - echo " Would create: GitHub release for v$VERSION" - echo "============================================" - - delay-for-test-v20250224: - runs-on: ubuntu-latest - needs: [check-skip-publish, detect-changes] - if: needs.check-skip-publish.outputs.skip_publish == 'false' - steps: - - name: Brief delay to stagger v20250224 publish - run: sleep 2 - - publish-test-v20250224: - needs: [check-skip-publish, detect-changes, delay-for-test-v20250224] - if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20250224 == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: test-auto-generate - - name: Simulate publish - run: | - VERSION=$(jq -r '.version' ./test-v20250224/package.json) - echo "============================================" - echo "✅ PUBLISH SUCCESS (simulated)" - echo " Package: mx-platform-node@$VERSION" - echo " Directory: test-v20250224/" - echo " Would run: npm publish from test-v20250224/" - echo "============================================" - - release-test-v20250224: - needs: [check-skip-publish, detect-changes, publish-test-v20250224] - if: needs.check-skip-publish.outputs.skip_publish == 'false' && needs.detect-changes.outputs.test_v20250224 == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: test-auto-generate - - name: Simulate release - run: | - VERSION=$(jq -r '.version' ./test-v20250224/package.json) - echo "============================================" - echo "✅ RELEASE SUCCESS (simulated)" - echo " Tag: v$VERSION" - echo " Directory: test-v20250224/" - echo " Would create: GitHub release for v$VERSION" - echo "============================================" diff --git a/TEST-CHANGELOG.md b/TEST-CHANGELOG.md deleted file mode 100644 index e32a3d1..0000000 --- a/TEST-CHANGELOG.md +++ /dev/null @@ -1,16 +0,0 @@ -# Test Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [99.0.0] - 2026-02-16 - -### Added -- Test placeholder for v20250224 sandbox testing - -## [98.0.0] - 2026-02-16 - -### Added -- Test placeholder for v20111101 sandbox testing diff --git a/openapi/test-config-v20111101.yml b/openapi/test-config-v20111101.yml deleted file mode 100644 index 1ffc7ab..0000000 --- a/openapi/test-config-v20111101.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: v20111101 -generatorName: typescript-axios -npmName: mx-platform-node -npmVersion: 98.0.0 -supportsES6: true -.openapi-generator-ignore: true diff --git a/openapi/test-config-v20250224.yml b/openapi/test-config-v20250224.yml deleted file mode 100644 index c80c9ee..0000000 --- a/openapi/test-config-v20250224.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -apiVersion: v20250224 -generatorName: typescript-axios -npmName: mx-platform-node -npmVersion: 99.0.0 -supportsES6: true -.openapi-generator-ignore: true diff --git a/test-v20111101/.gitkeep b/test-v20111101/.gitkeep deleted file mode 100644 index 559c920..0000000 --- a/test-v20111101/.gitkeep +++ /dev/null @@ -1,2 +0,0 @@ -# Placeholder for test-auto-generate workflow testing -# This directory mirrors v20111101/ for sandbox testing purposes diff --git a/test-v20250224/.gitkeep b/test-v20250224/.gitkeep deleted file mode 100644 index c0b4141..0000000 --- a/test-v20250224/.gitkeep +++ /dev/null @@ -1,2 +0,0 @@ -# Placeholder for test-auto-generate workflow testing -# This directory mirrors v20250224/ for sandbox testing purposes