Fix - Stripe PaymentIntent replay completing a different pending order #844
Workflow file for this run
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: User Registration QA Automation | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - ready_for_review | |
| - labeled | |
| branches: | |
| - develop | |
| concurrency: | |
| group: ur-qa-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| qa-automation: | |
| name: Run UR QA Automation | |
| if: > | |
| github.event.pull_request.draft == false && | |
| ( | |
| contains(github.event.pull_request.labels.*.name, 'qa-needed') || | |
| contains(github.event.pull_request.labels.*.name, 'final-qa') | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 🔍 Decide QA Mode (Smoke vs Final) | |
| - name: Decide QA mode | |
| id: qa_mode | |
| run: | | |
| if [[ "${{ contains(github.event.pull_request.labels.*.name, 'final-qa') }}" == "true" ]] || \ | |
| [[ "${{ startsWith(github.event.pull_request.title, 'final-qa') }}" == "true" ]]; then | |
| echo "mode=final" >> $GITHUB_OUTPUT | |
| else | |
| echo "mode=smoke" >> $GITHUB_OUTPUT | |
| fi | |
| # Checkout PR Code | |
| - name: Checkout PR branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| # SSH Setup | |
| - name: Setup SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.TG_PRIVATE_SSH_KEY }}" > ~/.ssh/id_rsa | |
| chmod 600 ~/.ssh/id_rsa | |
| # Git Config | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "${{ secrets.TG_GITHUB_EMAIL }}" | |
| git config --global user.name "${{ secrets.TG_GITHUB_USERNAME }}" | |
| # Environment Setup | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '7.4' | |
| extensions: cli, curl, mbstring, xmlrpc | |
| - name: Setup PNPM | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| # Build Plugin | |
| - name: Install & Build | |
| run: | | |
| pnpm install | |
| composer install | |
| pnpm run build | |
| composer install --no-dev | |
| mkdir -p user-registration | |
| rsync -rc --exclude-from="./.distignore" ./ user-registration --delete --delete-excluded | |
| - name: Create ZIP | |
| run: zip -r user-registration.zip user-registration | |
| # Deploy to QA Server | |
| - name: Remove old plugin | |
| run: | | |
| sshpass -p "${{ secrets.QA_AUTOMATION_SERVER_PASS }}" ssh -o StrictHostKeyChecking=no \ | |
| ${{ secrets.QA_AUTOMATION_SERVER_USERNAME }}@${{ secrets.QA_AUTOMATION_SERVER_IP }} << 'EOF' | |
| cd /var/www/anup-urautomation.wp1.site/wp-content/plugins/ | |
| rm -rf user-registration | |
| EOF | |
| - name: Upload plugin | |
| run: | | |
| sshpass -p "${{ secrets.QA_AUTOMATION_SERVER_PASS }}" scp -o StrictHostKeyChecking=no \ | |
| user-registration.zip \ | |
| ${{ secrets.QA_AUTOMATION_SERVER_USERNAME }}@${{ secrets.QA_AUTOMATION_SERVER_IP }}:/var/www/anup-urautomation.wp1.site/wp-content/plugins/ | |
| - name: Install via WP-CLI | |
| run: | | |
| sshpass -p "${{ secrets.QA_AUTOMATION_SERVER_PASS }}" ssh -o StrictHostKeyChecking=no \ | |
| ${{ secrets.QA_AUTOMATION_SERVER_USERNAME }}@${{ secrets.QA_AUTOMATION_SERVER_IP }} << 'EOF' | |
| cd /var/www/anup-urautomation.wp1.site/ | |
| wp plugin install wp-content/plugins/user-registration.zip --activate | |
| rm -f wp-content/plugins/user-registration.zip | |
| EOF | |
| # Browser Setup | |
| - name: Setup Chrome | |
| uses: browser-actions/setup-chrome@v1 | |
| # Python Setup | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.12.1 | |
| # Run Automation | |
| - name: Run UR Automation | |
| run: | | |
| mkdir python-code | |
| cd python-code | |
| git init | |
| git remote add origin git@github.com:wpeverest/UR-Automation.git | |
| git pull origin test-ur-free | |
| pip install -r requirements.txt | |
| chmod +x test_ur_free.sh | |
| bash ./test_ur_free.sh "${{ steps.qa_mode.outputs.mode }}" | |
| continue-on-error: true | |
| # Upload Artifact | |
| - name: Upload Report | |
| uses: actions/upload-artifact@v4 | |
| if: success() || failure() | |
| with: | |
| name: UR-Report | |
| path: python-code/results/ | |
| - name: Publish Report to Server | |
| if: always() | |
| run: | | |
| PR_ID=${{ github.event.pull_request.number }} | |
| RUN_ID=${{ github.run_number }} | |
| REMOTE_PATH="/var/www/anup-urautomation.wp1.site/reports/pr-${PR_ID}/run-${RUN_ID}" | |
| echo "Creating remote directory..." | |
| sshpass -p "${{ secrets.QA_AUTOMATION_SERVER_PASS }}" ssh -o StrictHostKeyChecking=no \ | |
| ${{ secrets.QA_AUTOMATION_SERVER_USERNAME }}@${{ secrets.QA_AUTOMATION_SERVER_IP }} \ | |
| "mkdir -p $REMOTE_PATH" | |
| echo "Uploading reports..." | |
| sshpass -p "${{ secrets.QA_AUTOMATION_SERVER_PASS }}" scp -r -o StrictHostKeyChecking=no \ | |
| python-code/results/* \ | |
| ${{ secrets.QA_AUTOMATION_SERVER_USERNAME }}@${{ secrets.QA_AUTOMATION_SERVER_IP }}:$REMOTE_PATH | |
| echo "Report URL:" | |
| echo "https://anup-urautomation.wp1.site/reports/pr-${PR_ID}/run-${RUN_ID}/report.html" | |
| - name: Comment PR with Execution Report | |
| if: always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const pr = context.issue.number; | |
| const run = context.runNumber; | |
| const reportUrl = `https://anup-urautomation.wp1.site/reports/pr-${pr}/run-${run}/report.html`; | |
| const body = `**Latest Report:** ${reportUrl}`; | |
| github.rest.issues.createComment({ | |
| issue_number: pr, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); |