Skip to content

Commit ec186c3

Browse files
GvieveGenevieve Nuebel
andauthored
Add temp workflow dispatch to test automation (#82)
Co-authored-by: Genevieve Nuebel <genevieve.nuebel@mx.com>
1 parent 75adfe5 commit ec186c3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/openapi-generate-and-push.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ name: "OpenAPI: Automated Generate and Push"
33
on:
44
repository_dispatch:
55
types: [generate_publish_release]
6+
workflow_dispatch:
7+
inputs:
8+
payload_json:
9+
description: 'JSON payload (e.g., {"api_versions":"v20111101","version":"patch","commit_sha":"abc123"})'
10+
required: false
11+
type: string
612

713
env:
14+
# Parse payload from workflow_dispatch if provided, otherwise empty object
15+
PARSED_PAYLOAD: ${{ fromJson(github.event.inputs.payload_json || '{}') }}
816
# Default to v20111101 only for backwards compatibility
917
# When openapi repo sends api_versions, use that instead
10-
VERSIONS_TO_GENERATE: ${{ github.event.client_payload.api_versions || 'v20111101' }}
18+
VERSIONS_TO_GENERATE: ${{ github.event.client_payload.api_versions || env.PARSED_PAYLOAD.api_versions || 'v20111101' }}
1119

1220
jobs:
1321
Setup:
@@ -64,7 +72,7 @@ jobs:
6472
- name: Bump version
6573
id: bump_version
6674
run: |
67-
NEW_VERSION=$(ruby .github/version.rb ${{ github.event.client_payload.version || 'patch' }} ${{ matrix.config_file }})
75+
NEW_VERSION=$(ruby .github/version.rb ${{ github.event.client_payload.version || env.PARSED_PAYLOAD.version || 'patch' }} ${{ matrix.config_file }})
6876
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
6977
- name: Clean repo
7078
run: ruby .github/clean.rb ${{ matrix.api_version }}
@@ -82,7 +90,7 @@ jobs:
8290
# Using commit SHA in URL to bypass cache and guarantee correct spec version
8391
# Falls back to 'master' if openapi doesn't send commit_sha
8492
openapi-generator-cli generate \
85-
-i https://raw.githubusercontent.com/mxenabled/openapi/${{ github.event.client_payload.commit_sha || 'master' }}/openapi/${{ matrix.api_version }}.yml \
93+
-i https://raw.githubusercontent.com/mxenabled/openapi/${{ github.event.client_payload.commit_sha || env.PARSED_PAYLOAD.commit_sha || 'master' }}/openapi/${{ matrix.api_version }}.yml \
8694
-g typescript-axios \
8795
-c ${{ matrix.config_file }} \
8896
-t ./openapi/templates \

0 commit comments

Comments
 (0)