Skip to content

Commit

Permalink
Enhance CODEOWNERS file handling in main.sh to include exact matches …
Browse files Browse the repository at this point in the history
…for file ownership
  • Loading branch information
endersonmenezes committed Nov 13, 2024
1 parent a06d449 commit 5d4ab46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,18 @@ echo "End of reading CODEOWNERS file"
NECESSARY_APPROVALS=()
while IFS= read -r FILE; do
for DIR_OR_FILE_OR_REGEX in "${!SET_FILE_OR_DIR_AND_OWNER[@]}"; do
echo "if [[ \"$FILE\" =~ $DIR_OR_FILE_OR_REGEX ]]; then"
if [[ "$FILE" =~ $DIR_OR_FILE_OR_REGEX ]]; then
echo
echo "FILE: $FILE is in CODEOWNERS"
echo "OWNER: ${SET_FILE_OR_DIR_AND_OWNER[$DIR_OR_FILE_OR_REGEX]}"
echo "LINE: ${DIR_OR_FILE_OR_REGEX}"
NECESSARY_APPROVALS+=(${SET_FILE_OR_DIR_AND_OWNER[$DIR_OR_FILE_OR_REGEX]})
elif [[ "$FILE" == $DIR_OR_FILE_OR_REGEX ]]; then
echo
echo "FILE: $FILE is in CODEOWNERS"
echo "OWNER: ${SET_FILE_OR_DIR_AND_OWNER[$DIR_OR_FILE_OR_REGEX]}"
echo "LINE: ${DIR_OR_FILE_OR_REGEX}"
NECESSARY_APPROVALS+=(${SET_FILE_OR_DIR_AND_OWNER[$DIR_OR_FILE_OR_REGEX]})
fi
done
done < changed_files.txt
Expand Down

0 comments on commit 5d4ab46

Please sign in to comment.