Delete f directory #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Detect All Folders | |
on: | |
push: | |
paths: | |
- '**/' # Mendeteksi semua perubahan di dalam folder | |
jobs: | |
update-html: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Generate folder list | |
run: | | |
# Nama file HTML yang akan diperbarui | |
html_file="index.html" # Ganti dengan nama file HTML Anda | |
# Membaca konten file HTML | |
if [ ! -f "$html_file" ]; then | |
echo "File $html_file not found!" | |
exit 1 # Keluar jika file tidak ada | |
fi | |
html_content=$(<"$html_file") | |
# Mencari semua folder dan membuat list | |
folder_list="" | |
for dir in $(find . -type d); do | |
folder_list+="<li>${dir}</li>\n" | |
done | |
# Mengganti placeholder dengan daftar folder | |
updated_html=${html_content//<!-- FOLDER_LIST_PLACEHOLDER -->/$folder_list} | |
# Menyimpan hasil ke file yang sama | |
echo -e "$updated_html" > "$html_file" | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions" | |
git config --local user.email "github-actions@github.com" | |
# Memeriksa apakah ada perubahan untuk di-commit | |
if ! git diff --quiet; then | |
git add "$html_file" | |
git commit -m "Update folder list in index.html" | |
else | |
echo "No changes to commit" | |
fi | |
git push |