|
| 1 | +name: Trigger OSD Build Image Workflow |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + repository: |
| 7 | + description: Target repository |
| 8 | + required: true |
| 9 | + python_version: |
| 10 | + description: Python version |
| 11 | + type: string |
| 12 | + default: '3.9.17' |
| 13 | + required: true |
| 14 | + Node_version: |
| 15 | + description: Node version |
| 16 | + type: string |
| 17 | + default: '18.19.0' |
| 18 | + required: true |
| 19 | + OpenSearch-Dashboards_version: |
| 20 | + description: OpenSearch-Dashboards version |
| 21 | + type: string |
| 22 | + default: '3.0.0' |
| 23 | + required: true |
| 24 | + additional_args: |
| 25 | + description: JSON of additional options |
| 26 | + type: string |
| 27 | + default: '{}' |
| 28 | + required: true |
| 29 | + build_number: |
| 30 | + description: Build number |
| 31 | + type: string |
| 32 | + default: '' |
| 33 | + required: false |
| 34 | + |
| 35 | +jobs: |
| 36 | + trigger-osd-build-image: |
| 37 | + runs-on: ubuntu-latest |
| 38 | + steps: |
| 39 | + - name: Trigger Build-OSD-Image Workflow |
| 40 | + uses: actions/github-script@v5 |
| 41 | + with: |
| 42 | + github-token: ${{ secrets.GH_ACCESS_TOKEN_RUNNER }} |
| 43 | + script: | |
| 44 | + const repositoryName = '${{ github.event.inputs.repository }}'; |
| 45 | + const pythonVersion = '${{ github.event.inputs.python_version }}'; |
| 46 | + const nodeVersion = '${{ github.event.inputs.Node_version }}'; |
| 47 | + const osdVersion = '${{ github.event.inputs.OpenSearch-Dashboards_version }}'; |
| 48 | + const additionalArgs = '${{ github.event.inputs.additional_args }}'; |
| 49 | + const buildNumber = '${{ github.event.inputs.build_number }}'; |
| 50 | +
|
| 51 | + const response = await octokit.request('POST /repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches', { |
| 52 | + owner: 'Flyingliuhub', |
| 53 | + repo: repositoryName, |
| 54 | + workflow_id: 'Build-OSD-Image', // Replace with the actual workflow ID |
| 55 | + ref: 'main', // Replace with the branch you want to trigger |
| 56 | + inputs: { |
| 57 | + python_version: pythonVersion, |
| 58 | + Node_version: nodeVersion, |
| 59 | + OpenSearch-Dashboards_version: osdVersion, |
| 60 | + additional_args: additionalArgs, |
| 61 | + build_number: buildNumber, |
| 62 | + }, |
| 63 | + }); |
| 64 | + console.log(response.data); |
0 commit comments