Swiftproxy & Rapidproxy Sponsorships #35
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: Patchright Driver .Patch File Updater | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| jobs: | |
| patch-file-updater: | |
| name: "Patchright Driver .Patch File Updater: Create and Commit Patch File Comparing" | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v6 | |
| - name: Configure Fast APT Mirror | |
| uses: vegardit/fast-apt-mirror.sh@v1 | |
| - name: Setup Node v24 | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install NPM Dependencies | |
| run: npm install | |
| - name: Get Commit Author and Message | |
| id: get_commit_info | |
| run: | | |
| AUTHOR=$(git log -1 --pretty=format:'%an') | |
| COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s') | |
| echo "author=$AUTHOR" >> $GITHUB_OUTPUT | |
| echo "commit_message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT | |
| - name: Skip if Commit is from GitHub Actions | |
| if: contains(steps.get_commit_info.outputs.author, 'github-actions') | |
| run: echo "Skipping action as the commit is from github-actions" && exit 0 | |
| - name: Install Playwright Driver | |
| run: | | |
| response=$(curl --silent "https://api.github.com/repos/microsoft/playwright/releases/latest") | |
| version=$(echo "$response" | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/') | |
| git clone https://github.com/microsoft/playwright --branch "$version" | |
| cd playwright | |
| npm ci | |
| - name: Create Patched Copy of Playwright Driver | |
| run: | | |
| cp -r playwright playwright_not_patched | |
| cd playwright | |
| git -C .. submodule update --init --recursive --remote patchright-nodejs | |
| cd .. && npm run patch | |
| mv playwright patchright | |
| mv playwright_not_patched playwright | |
| - name: Compare Directories and Create Patch File | |
| run: | | |
| echo "# NOTE: This patch file is generated automatically and is not used, it is only for documentation. The driver is actually patched using [patchright_driver_patch](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright/blob/main/patchright_driver_patch.ts), see [the workflow](https://github.com/Kaliiiiiiiiii-Vinyzu/patchright/blob/main/.github/workflows/patch_file_updater.yml)" > patchright.patch | |
| diff -ruN -x protocol.yml --minimal playwright patchright | sed -E 's/^(---|\+\+\+) .*/\1/' >> patchright.patch || true | |
| - name: Commit and Push Patch File | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "[Patch-Comparison] Automatic Commit: ${{ steps.get_commit_info.outputs.commit_message }}" | |
| branch: "main" | |
| file_pattern: "patchright.patch" | |
| skip_fetch: true |