Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ jobs:
"BannedSymbols.txt"
"*.globalconfig"
"*.ruleset"
"*.DotSettings"
".github/workflows/*.yml"
".github/workflows/*.yaml"
)
Expand Down Expand Up @@ -200,14 +201,16 @@ jobs:
fi
done

# Check .globalconfig, .ruleset, and workflow files using the same git diff approach
# Check .globalconfig, .ruleset, .DotSettings, and workflow files using
# the same git diff approach.
# --diff-filter=AMRCD: Added, Modified, Renamed, Copied, Deleted.
# Including D so a PR that *deletes* a protected file (workflow,
# .globalconfig, .ruleset) also triggers the maintainer-review gate
# — a silent deletion is just as security-relevant as a silent edit.
# .globalconfig, .ruleset, .DotSettings) also triggers the
# maintainer-review gate — a silent deletion is just as
# security-relevant as a silent edit.
while IFS= read -r file; do
changed_files+=("$file")
done < <(git diff --name-only --diff-filter=AMRCD main-branch HEAD 2>/dev/null | grep -E '(\.(globalconfig|ruleset)|^\.github/workflows/.*\.ya?ml)$' || true)
done < <(git diff --name-only --diff-filter=AMRCD main-branch HEAD 2>/dev/null | grep -E '(\.(globalconfig|ruleset|DotSettings)|^\.github/workflows/.*\.ya?ml)$' || true)

if [ ${#changed_files[@]} -gt 0 ]; then
echo ""
Expand Down Expand Up @@ -302,6 +305,7 @@ jobs:
"BannedSymbols.txt"
"*.globalconfig"
"*.ruleset"
"*.DotSettings"
".github/workflows/*.yml"
".github/workflows/*.yaml"
)
Expand Down Expand Up @@ -455,6 +459,7 @@ jobs:
"BannedSymbols.txt"
"*.globalconfig"
"*.ruleset"
"*.DotSettings"
".github/workflows/*.yml"
".github/workflows/*.yaml"
)
Expand Down Expand Up @@ -870,7 +875,7 @@ jobs:
}

# Handle glob patterns for .globalconfig, .ruleset, and workflow files
$globPatterns = @("*.globalconfig", "*.ruleset", ".github/workflows/*.yml", ".github/workflows/*.yaml")
$globPatterns = @("*.globalconfig", "*.ruleset", "*.DotSettings", ".github/workflows/*.yml", ".github/workflows/*.yaml")
foreach ($pattern in $globPatterns) {
$files = git ls-tree -r --name-only main-branch | Select-String -Pattern $pattern.Replace("*", ".*")
foreach ($file in $files) {
Expand Down Expand Up @@ -1167,6 +1172,7 @@ jobs:
"BannedSymbols.txt"
"*.globalconfig"
"*.ruleset"
"*.DotSettings"
".github/workflows/*.yml"
".github/workflows/*.yaml"
)
Expand Down Expand Up @@ -1554,6 +1560,7 @@ jobs:
"BannedSymbols.txt"
"*.globalconfig"
"*.ruleset"
"*.DotSettings"
".github/workflows/*.yml"
".github/workflows/*.yaml"
)
Expand Down
Loading