Skip to content

Commit

Permalink
generate readme based on template
Browse files Browse the repository at this point in the history
  • Loading branch information
on committed Aug 15, 2024
1 parent ed9025d commit 30d8458
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
20 changes: 20 additions & 0 deletions ReadmeTemplete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Monkey Magic

TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.)

# Scripts
{scriptlist}

# Contribute
1. Clone the repository
2. Pull the latest changes. (Important since the README.md is generated)
```bash
git pull
```
3. Add your script to the repository
```bash
git add myscript.user.js
git commit -m "Added my script"
git push
```
4. A Github Action will be automatically triggered and generate a new README.md file.
18 changes: 7 additions & 11 deletions generate-readme.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
"# Monkey Magic"
""
"TamperMonkey scripts for å gjøre websider bedre. (Fuglane, Innsida osv.)"
""
"# Scripts"
""

# Define the directory containing the user scripts
$UserScripts = "."

Expand All @@ -16,6 +9,9 @@ $regEx = [regex]'\/\/\s+@(\w+)\s+(.+)'
# Initialize an array to hold the table rows
$tableRows = @()

$tableRows = "| Filename | Name | Description |"
$tableRows += "|----------|------|-------------|"

# Loop through each file
foreach ($file in $userJsFiles) {
# Read the file content
Expand Down Expand Up @@ -52,7 +48,7 @@ foreach ($file in $userJsFiles) {
$tableRows += "| [$($file.Name)](https://git.ntnu.no/M365-Drift/MonkeyMagic/raw/main/$($file.Name)) | $name | $description |"
}

# Output the markdown table
Write-Output "| Filename | Name | Description |"
Write-Output "|----------|------|-------------|"
$tableRows | ForEach-Object { Write-Output $_ }
#$tableRows | ForEach-Object { Write-Output $_ }

$template = Get-Content .\ReadmeTemplete.md
$template -replace '{scriptlist}', $tableRows

0 comments on commit 30d8458

Please sign in to comment.