Skip to content

Update ads.yml

Update ads.yml #121

Workflow file for this run

name: Remove Ads
on:
push:
branches:
- main
jobs:
update-ad-free:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Ad-Free branch
run: |
git fetch origin main
if git ls-remote --heads origin Ad-Free; then
git checkout Ad-Free
git merge origin/main --no-edit
else
git checkout -b Ad-Free origin/main
fi
- name: Remove ad script block from m.js
run: |
sed -i '/const blockedHostnames/,/document.body.appendChild(script);/d' static/assets/js/m1.js
- name: Commit changes
env:
GIT_USERNAME: ${{ secrets.GIT_USERNAME }}
GIT_EMAIL: ${{ secrets.GIT_EMAIL }}
run: |
git config --global user.name "${GIT_USERNAME}"
git config --global user.email "${GIT_EMAIL}"
if git diff --quiet; then
echo "No changes detected"
else
git add static/assets/js/m1.js
git commit -m "Remove ad injection block from m1.js"
fi
- name: Push changes
run: git push origin Ad-Free --force