Main Workflow Dispatch #72
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Main Workflow Dispatch | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| breadth: | |
| type: number | |
| default: 2 | |
| max-depth: | |
| type: number | |
| default: 1 | |
| website-url: | |
| type: string | |
| default: "https://kzmkgze3v46fyc6paipj.lite.vusercontent.net/login" | |
| app-url: | |
| type: string | |
| prerun: | |
| type: string | |
| username: | |
| type: string | |
| password: | |
| type: string | |
| setup: | |
| type: string | |
| jobs: | |
| generate-prerun: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| prerun: ${{ steps.set_prerun.outputs.prerun }} | |
| app-type: ${{ steps.set_app_type.outputs.app_type }} | |
| setup: ${{ steps.setup.outputs.result }} | |
| steps: | |
| - name: Set PRERUN variable | |
| id: set_prerun | |
| run: | | |
| { | |
| echo "prerun<<EOF" | |
| if [ -n "${{ inputs.app-url }}" ]; then | |
| echo "Invoke-WebRequest ${{ inputs.app-url }} -OutFile app.exe" | |
| echo "Start-Process ./app.exe" | |
| elif [ -n "${{ inputs.website-url }}" ]; then | |
| cat << 'SCRIPT' | |
| cd $env:TEMP | |
| npm init -y | |
| npm install dashcam-chrome | |
| Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized","--load-extension=$(pwd)/node_modules/dashcam-chrome/build","${{ inputs.website-url }}" | |
| SCRIPT | |
| fi | |
| echo "${{ inputs.prerun }}" | |
| echo "exit" | |
| echo "EOF" | |
| } >> $GITHUB_OUTPUT | |
| - name: Set app_type variable | |
| id: set_app_type | |
| run: | | |
| if [ -n "${{ inputs.app-url }}" ]; then | |
| echo "app_type=desktop" >> $GITHUB_OUTPUT | |
| elif [ -n "${{ inputs.website-url }}" ]; then | |
| echo "app_type=web" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: 'actions/github-script@v6' | |
| id: setup | |
| env: | |
| LOGIN_USERNAME: ${{ inputs.username }} | |
| LOGIN_PASSWORD: ${{ inputs.password }} | |
| SETUP_INSTRUCTIONS: ${{ inputs.setup }} | |
| with: | |
| script: | | |
| let instructions = []; | |
| const username = process.env.LOGIN_USERNAME; | |
| const password = process.env.LOGIN_PASSWORD; | |
| const setup = process.env.SETUP_INSTRUCTIONS; | |
| if (username && password) { | |
| instructions.push(`login with username ${ username }} and password ${ login_password }`) | |
| } | |
| if (setup) { | |
| instructions = [...instructions, ...setup.split(";")]; | |
| } | |
| if (instructions.length) { | |
| instructions.push("/save prerun.yml"); | |
| } | |
| return instructions; | |
| generate: | |
| uses: ./.github/workflows/generate.yml | |
| needs: [generate-prerun] | |
| with: | |
| dispatchId: manual-${{ github.run_id }} | |
| primaryId: ${{ github.run_id }} | |
| breadth: ${{ fromJson(inputs.breadth) }} | |
| max-depth: ${{ fromJson(inputs.max-depth) }} | |
| prerun: ${{ needs.generate-prerun.outputs.prerun }} | |
| app-type: ${{ needs.generate-prerun.outputs.app-type }} | |
| setup-instructions: ${{ needs.generate-prerun.outputs.setup }} | |
| secrets: | |
| TESTDRIVER_API_KEY: ${{ secrets.TESTDRIVER_API_KEY }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |