Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/apply-picviewer-qr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Apply Picviewer QR patch

on:
push:
branches:
- feature/picviewer-qr-scan
paths:
- "Picviewer CE+/tools/apply-qr-patch.js"
- ".github/workflows/apply-picviewer-qr.yml"
workflow_dispatch:

permissions:
contents: write

jobs:
patch-and-verify:
runs-on: ubuntu-latest
steps:
- name: Check out feature branch
uses: actions/checkout@v4
with:
ref: feature/picviewer-qr-scan
fetch-depth: 0

- name: Apply QR integration
run: node "Picviewer CE+/tools/apply-qr-patch.js"

- name: Verify JavaScript syntax
run: node --check "Picviewer CE+/Picviewer CE+.user.js"

- name: Verify patch markers
shell: bash
run: |
set -euo pipefail
file="Picviewer CE+/Picviewer CE+.user.js"
grep -Fq "// @resource jsQR https://cdn.jsdelivr.net/npm/jsqr@1.4.0/dist/jsQR.js" "$file"
grep -Fq "// Picviewer QR integration start" "$file"
grep -Fq "case 'qr':" "$file"
grep -Fq "pv-float-bar-button-qr" "$file"
grep -Fq "actual,current,qr,gallery,magnifier,download,stitch" "$file"
test "$(grep -Fc "// Picviewer QR integration start" "$file")" -eq 1

- name: Verify clean diff
run: git diff --check

- name: Commit generated integration
shell: bash
run: |
if git diff --quiet; then
echo "QR integration is already up to date."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add "Picviewer CE+/Picviewer CE+.user.js"
git commit -m "feat(picviewer): add QR code scanner"
git push origin HEAD:feature/picviewer-qr-scan
Loading