name: Build Obfuscate BPB Panel
on:
push:
branches:
- main
schedule:
- cron: "0 2 * * *"
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Check out the code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
- name: Install dependencies
run: |
npm install -g javascript-obfuscator
- name: Clone BPB workjs
run: |
wget -O origin.js https://raw.githubusercontent.com/bia-pain-bache/BPB-Worker-Panel/refs/heads/main/build/unobfuscated-worker.js
- name: Check file size
run: |
ls -lh origin.js
- name: Obfuscate BPB worker js
run: |
javascript-obfuscator origin.js --output worker.js \
--compact true \
--control-flow-flattening true \
--control-flow-flattening-threshold 1 \
--dead-code-injection true \
--dead-code-injection-threshold 1 \
--identifier-names-generator hexadecimal \
--rename-globals true \
--string-array true \
--string-array-encoding 'rc4' \
--string-array-threshold 1 \
--transform-object-keys true \
--unicode-escape-sequence true
- name: Check if obfuscated file changed
id: check_changes
run: |
if git diff --quiet _worker.js; then
echo "No changes detected. Skipping commit."
echo "::set-output name=changed::false"
else
echo "Changes detected. Proceeding with commit."
echo "::set-output name=changed::true"
fi
- name: Commit changes
if: steps.check_changes.outputs.changed == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: main
commit_message: ':arrow_up: update latest bpb panel'