GitHub Action Check Folder Name - SSWConsulting/SSW.Rules.Content GitHub Wiki
Check Folder Name
This GitHub Action automatically checks whether the folder name of a rule matches its uri (as defined in rule.md). If there's a mismatch, it renames the folder and updates the redirects field in rule.md to avoid broken links.
When It Runs
This workflow runs on pull requests that modify any rule.md file.
It gets triggered when:
-
A PR is opened
-
A PR is updated (synchronized)
What It Does
-
Checks out the pull request code
Ensures itโs working with the latest PR branch and all changes -
Checks for modified
rule.mdfiles
Usesgit diffto determine whether anyrule.mdfile has changed compared toorigin/main. -
Runs folder renaming logic
If a modifiedrule.mdis found, it runs a shell script (.workflow/rename-folders.sh) that:-
Reads the
uri:field from each changedrule.md -
Compares it to the folder name
-
Renames the folder if there's a mismatch
-
Updates the
redirects:field inrule.mdto include the old folder name, so previous URLs still work
-
-
Commits and pushes the changes
If any folders were renamed, it automatically commits and pushes the changes back to the PR branch with the message:
"Rename folder to match URI"