Merge branch 'dev_odex25_takaful' of https://github.com/expsa/odex25-standard-modules into dev_odex25_takaful

This commit is contained in:
Ali Ammar 2025-11-26 16:28:19 +03:00
commit 2b372cf824
2 changed files with 45 additions and 43 deletions

View File

@ -23,38 +23,38 @@ jobs:
#######################################################
# 🟦 1) Allowed Users List
#######################################################
ALLOWED_USERS=(
"expsa"
"moutazmuhammad"
"ronozoro"
"Abubaker-Altaib"
"altexp"
"the5abir"
"ahmadaking"
"kchyounes19"
"abdurrahman-saber"
"maltayyar2"
"esam-sermah"
"mohammed-alkhazrji"
)
# ALLOWED_USERS=(
# "expsa"
# "moutazmuhammad"
# "ronozoro"
# "Abubaker-Altaib"
# "altexp"
# "the5abir"
# "ahmadaking"
# "kchyounes19"
# "abdurrahman-saber"
# "maltayyar2"
# "esam-sermah"
# "mohammed-alkhazrji"
# )
IS_ALLOWED="false"
for user in "${ALLOWED_USERS[@]}"; do
if [[ "$CREATOR" == "$user" ]]; then
IS_ALLOWED="true"
break
fi
done
# IS_ALLOWED="false"
# for user in "${ALLOWED_USERS[@]}"; do
# if [[ "$CREATOR" == "$user" ]]; then
# IS_ALLOWED="true"
# break
# fi
# done
if [[ "$IS_ALLOWED" == "false" ]]; then
echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..."
curl -s -X DELETE \
-H "Authorization: token $GH_TOKEN" \
https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME
exit 1
fi
# if [[ "$IS_ALLOWED" == "false" ]]; then
# echo "❌ User '$CREATOR' is NOT allowed to create branches. Deleting..."
# curl -s -X DELETE \
# -H "Authorization: token $GH_TOKEN" \
# https://api.github.com/repos/$REPO/git/refs/heads/$BRANCH_NAME
# exit 1
# fi
echo "✔ User '$CREATOR' is allowed."
# echo "✔ User '$CREATOR' is allowed."
#######################################################
# 🟦 2) Reserved Branch Names (Your Existing List)

View File

@ -82,21 +82,23 @@ jobs:
pull_number: pr.number
});
for (const commit of commitList.data) {
const commitAuthor = commit.author ? commit.author.login : null;
core.info("PR author is allowed.");
# for (const commit of commitList.data) {
# const commitAuthor = commit.author ? commit.author.login : null;
if (commitAuthor && !allowed.includes(commitAuthor)) {
core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
# if (commitAuthor && !allowed.includes(commitAuthor)) {
# core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
await github.rest.pulls.update({
owner,
repo,
pull_number: pr.number,
state: "closed"
});
# await github.rest.pulls.update({
# owner,
# repo,
# pull_number: pr.number,
# state: "closed"
# });
return;
}
}
# return;
# }
# }
core.info("All PR authors and committers are allowed.");
# core.info("All PR authors and committers are allowed.");