From 9a31058d9007e7f3c71d83aee60119299eec4133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Wed, 26 Nov 2025 14:19:00 +0200 Subject: [PATCH 1/3] Update github action file --- .github/workflows/restrict-pr-authors.yaml | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/restrict-pr-authors.yaml b/.github/workflows/restrict-pr-authors.yaml index 5a8e9bab5..6f47e2da0 100644 --- a/.github/workflows/restrict-pr-authors.yaml +++ b/.github/workflows/restrict-pr-authors.yaml @@ -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."); From 32d5474999d70e1a6d3faea3ce5b170310de38ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Wed, 26 Nov 2025 14:20:45 +0200 Subject: [PATCH 2/3] Update github action file --- .github/workflows/block_reserved_branches.yml | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/block_reserved_branches.yml b/.github/workflows/block_reserved_branches.yml index ba3fc471b..4a73aef74 100644 --- a/.github/workflows/block_reserved_branches.yml +++ b/.github/workflows/block_reserved_branches.yml @@ -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) From c943c218b2c8bb63aef18d38cbb1fe161c87ec2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=B4=D8=B1=D9=83=D8=A9=20=D8=AE=D8=A8=D9=8A=D8=B1=20?= =?UTF-8?q?=D8=A7=D9=84=D9=85=D8=AD=D8=AF=D9=88=D8=AF=D8=A9?= Date: Wed, 26 Nov 2025 15:33:45 +0200 Subject: [PATCH 3/3] Update github action file --- .github/workflows/restrict-pr-authors.yaml | 49 ++++++++++++---------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/.github/workflows/restrict-pr-authors.yaml b/.github/workflows/restrict-pr-authors.yaml index 6f47e2da0..56f41ab06 100644 --- a/.github/workflows/restrict-pr-authors.yaml +++ b/.github/workflows/restrict-pr-authors.yaml @@ -31,6 +31,7 @@ on: - dev_odex25_helpdesk - dev_odex25_donation - dev_odex25_ensan + jobs: check_pr_author: runs-on: linting_odex25-standard-modules_runner @@ -74,31 +75,35 @@ jobs: }); return; } + core.info("All PR authors are allowed."); - // Check commit authors - const commitList = await github.rest.pulls.listCommits({ - owner, - repo, - pull_number: pr.number - }); +# // Check commit authors +# const commitList = await github.rest.pulls.listCommits({ +# owner, +# repo, +# pull_number: pr.number +# }); - core.info("PR author is allowed."); - - # for (const commit of commitList.data) { - # const commitAuthor = commit.author ? commit.author.login : null; +# core.info("PR author is allowed."); - # if (commitAuthor && !allowed.includes(commitAuthor)) { - # core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`); +# // Uncomment below if you want to block unauthorized commit authors also +# /* +# for (const commit of commitList.data) { +# const commitAuthor = commit.author ? commit.author.login : null; - # await github.rest.pulls.update({ - # owner, - # repo, - # pull_number: pr.number, - # state: "closed" - # }); +# if (commitAuthor && !allowed.includes(commitAuthor)) { +# core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`); - # return; - # } - # } +# await github.rest.pulls.update({ +# owner, +# repo, +# pull_number: pr.number, +# state: "closed" +# }); - # core.info("All PR authors and committers are allowed."); +# return; +# } +# } + +# core.info("All PR authors and committers are allowed."); +# */