TestDriver.ai / Generate / Exploratory #119
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: TestDriver.ai / Generate / Exploratory | |
| permissions: | |
| actions: write | |
| contents: write | |
| statuses: write | |
| pull-requests: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| website-url: | |
| type: string | |
| required: true | |
| depth: | |
| type: number | |
| default: 0 | |
| base-branch: | |
| type: string | |
| required: true | |
| default: main | |
| previous-file: | |
| type: string | |
| required: false | |
| description: Filename containing markdown content from previous regression step | |
| workflow_call: | |
| inputs: | |
| website-url: | |
| type: string | |
| required: true | |
| depth: | |
| type: number | |
| default: 0 | |
| base-branch: | |
| type: string | |
| required: true | |
| default: main | |
| previous-file: | |
| type: string | |
| required: false | |
| description: Filename containing markdown content from previous regression step | |
| outputs: | |
| pr-branch: | |
| value: ${{ jobs.exploratory.outputs.pr-branch }} | |
| jobs: | |
| exploratory: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| pr-branch: ${{ steps.create-pr-branch.outputs.pr-branch }} | |
| steps: | |
| - name: Check recursion depth | |
| run: | | |
| if [ ${{ inputs.depth }} -ge 3 ]; then | |
| echo "Max recursion depth reached. Exiting." | |
| exit 0 | |
| fi | |
| - id: create-pr-branch | |
| name: Create PR branch name | |
| shell: bash | |
| run: echo "pr-branch=testdriver/exploratory-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_OUTPUT | |
| - uses: testdriverai/action@main | |
| continue-on-error: true | |
| with: | |
| key: ${{ secrets.TESTDRIVER_API_KEY }} | |
| prompt: | | |
| ${{ inputs.previous-file && format('1. /run testdriver/{0}', inputs.previous-file) || '' }} | |
| 1. /generate web 3 | |
| 2. /summarize | |
| prerun: | | |
| 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 }}" | |
| exit | |
| create-pr: true | |
| branch: ${{ inputs.base-branch }} | |
| pr-base: ${{ inputs.base-branch }} | |
| pr-title: "TestDriver.ai / Generate Test Plans - Depth ${{ inputs.depth }}" | |
| pr-branch: ${{ steps.create-pr-branch.outputs.pr-branch }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| FORCE_COLOR: "3" | |
| - name: Calculate Next Depth | |
| id: increment-depth | |
| run: echo "NEXT_DEPTH=$(( ${{ inputs.depth }} + 1 ))" >> $GITHUB_ENV | |
| - name: Trigger Next-Level Exploratory Workflow | |
| if: inputs.depth < 3 | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: "generate-regressions.yml", | |
| ref: context.ref, | |
| inputs: { | |
| "website-url": "${{ inputs.website-url }}", | |
| "base-branch": "${{ steps.create-pr-branch.outputs.pr-branch }}", | |
| "previous-file": "${{ inputs.previous-file }}", | |
| "depth": process.env.NEXT_DEPTH | |
| } | |
| }); |