Skip to content

Update README.md

Update README.md #2

Workflow file for this run

name: Update README with jsdelivr content
on:
push:
branches:
- main # Trigger on pushes to the main branch
workflow_dispatch: # Allows manual triggering
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Fetch content from jsdelivr
id: fetch-jsdelivr
run: |
curl -s https://cdn.jsdelivr.net/gh/SomeTechyGuy/Cloudflare-WAF-Rule@main/AntiDDos.txt -o content.txt
- name: Update README.md
run: |
START_MARKER='<!-- BEGIN JSDELIVR CONTENT -->'
END_MARKER='<!-- END JSDELIVR CONTENT -->'
CONTENT=$(cat content.txt)
# Read the existing README.md content
README=$(cat README.md)
# Extract the part before and after the markers
BEFORE_MARKER=$(echo "$README" | sed -n "/$START_MARKER/,\$!p")
AFTER_MARKER=$(echo "$README" | sed -n "/$END_MARKER/,\$p" | tail -n +2)
# Create the new README content
echo "$BEFORE_MARKER" > README.md
echo "$START_MARKER" >> README.md
echo '```plaintext' >> README.md
echo "$CONTENT" >> README.md
echo '```' >> README.md
echo "$END_MARKER" >> README.md
echo "$AFTER_MARKER" >> README.md
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add README.md
git commit -m 'Update README with latest jsdelivr content'
git push