Skip to content

Update vulnerable-pages-table.yml #20

Update vulnerable-pages-table.yml

Update vulnerable-pages-table.yml #20

name: Update README on Folder Creation
on:
create:
branches:
- main # Adjust this based on your default branch name
# You might need to adjust the 'paths' pattern to match your folder structure
# This example assumes all new directories follow the pattern ASVS_\d_\d_\d
paths:
- 'ASVS_*/*'
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Generate Table
id: generate-table
run: |
# Find all directories matching the pattern and generate the table
table=""
for dir in ASVS_*/*; do
if [ -d "$dir" ]; then
link=$(echo "$dir" | sed 's/\//%2F/g' | sed 's/ASVS_/https:\/\/snbig.github.io\/Vulnerable-Pages\/ASVS_/g')
table+="| $(basename "$dir") | [ASVS Requirement]( $link ) |\n"
fi
done
echo "$table" > table.md
- name: Append Table to README
run: |
# Append the generated table to the README.md file
cat table.md >> README.md
- name: Commit and push changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@users.noreply.github.com'
git add README.md
git commit -m "Auto-update README with new folder information"
git push