Skip to content

TEST: Generated SDK versions: v20111101,v20250224 #7

TEST: Generated SDK versions: v20111101,v20250224

TEST: Generated SDK versions: v20111101,v20250224 #7

Workflow file for this run

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 "============================================"