Update github action file
This commit is contained in:
parent
34b2e2a78a
commit
ffc72e24cf
|
|
@ -31,7 +31,7 @@ on:
|
||||||
- dev_odex25_donation
|
- dev_odex25_donation
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
validate:
|
validate_pr_author:
|
||||||
runs-on: linting_odex25-standard-modules_runner
|
runs-on: linting_odex25-standard-modules_runner
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -40,26 +40,24 @@ jobs:
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.PR_CLOSE_TOKEN }}
|
github-token: ${{ secrets.PR_CLOSE_TOKEN }}
|
||||||
script: |
|
script: |
|
||||||
// List of allowed users (all lowercase)
|
|
||||||
const allowed = [
|
const allowed = [
|
||||||
"expsa",
|
"expsa",
|
||||||
"moutazmuhammad",
|
"moutazmuhammad",
|
||||||
"ronozoro",
|
"ronozoro",
|
||||||
"abubaker-altaib",
|
"Abubaker-Altaib",
|
||||||
"altexp",
|
"altexp",
|
||||||
"the5abir",
|
"the5abir",
|
||||||
"ahmadaking",
|
"ahmadaking",
|
||||||
"kchyounes19",
|
"kchyounes19",
|
||||||
"abdurrahman-saber"
|
"abdurrahman-saber"
|
||||||
].map(u => u.toLowerCase());
|
];
|
||||||
|
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
const prAuthor = pr.user.login.toLowerCase();
|
const prAuthor = pr.user.login;
|
||||||
const owner = context.repo.owner;
|
const owner = context.repo.owner;
|
||||||
const repo = context.repo.repo;
|
const repo = context.repo.repo;
|
||||||
|
|
||||||
core.info(`PR author: ${prAuthor}`);
|
core.info(`PR author: ${prAuthor}`);
|
||||||
core.info(`Allowed users: ${allowed.join(", ")}`);
|
|
||||||
|
|
||||||
// Check PR author
|
// Check PR author
|
||||||
if (!allowed.includes(prAuthor)) {
|
if (!allowed.includes(prAuthor)) {
|
||||||
|
|
@ -81,11 +79,7 @@ jobs:
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const commit of commitList.data) {
|
for (const commit of commitList.data) {
|
||||||
const commitAuthor = commit.author ? commit.author.login.toLowerCase() : null;
|
const commitAuthor = commit.author ? commit.author.login : null;
|
||||||
|
|
||||||
if (!commit.author) {
|
|
||||||
core.warning(`Commit ${commit.sha} has no GitHub-linked author.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commitAuthor && !allowed.includes(commitAuthor)) {
|
if (commitAuthor && !allowed.includes(commitAuthor)) {
|
||||||
core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
|
core.error(`Unauthorized commit author: ${commitAuthor}. Closing PR...`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue