Skip to content

Add ASVS_5_1_5

Add ASVS_5_1_5 #63

name: Update README Table
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Read existing table (optional)
run: |
set +e
existing_table=$(cat README.md | grep -E '^## ASVS Pages| ASVS Req\. ID \| Link \|$\n')
if [[ ! -z "$existing_table" ]]; then
echo "Existing table found. Updating..."
else
echo "No existing table found. Creating new table..."
fi
folders=$(find . -type d -regex ".*/ASVS_[0-9]+_[0-9]+_[0-9]+")
echo $folders
content=""
for folder in $folders; do
req_id=$(basename "$folder" | sed 's/ASVS_\([0-9]\+\).\([0-9]\+\).\([0-9]\+\)/ASVS \1.\2.\3/')
link="https://snbig.github.io/Vulnerable-Pages/${folder/.\//}"
content+="| $req_id | [$link]($link) |\n"
done
# Append table content if no existing table found, otherwise replace the existing table content
if [[ -z "$existing_table" ]]; then
echo "## ASVS Pages" >> README.md
echo "| ASVS Req. ID | Link |" >> README.md
echo "|---|---|" >> README.md
echo -e "$content" >> README.md
else
echo "$existing_table" | grep -Ev '^## ASVS Pages\n' | head -n -2 >> README.md.tmp
echo "## ASVS Pages" >> README.md.tmp
echo "| ASVS Req. ID | Link |" >> README.md.tmp
echo "|---|---|" >> README.md.tmp
echo -e "$content" >> README.md.tmp
cat README.md.tmp > README.md
rm README.md.tmp
fi
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Update README table
commit_user_name: GitHub Actions
commit_user_email: github-actions[bot]@users.noreply.github.com
branch: main # Replace with your desired branch
file_pattern: README.md