slawekjaranowski commented on code in PR #330:
URL:
https://github.com/apache/maven-gh-actions-shared/pull/330#discussion_r4186593743
##########
.github/workflows/pr-check.yml:
##########
@@ -71,6 +71,10 @@ jobs:
return;
}
+ // Values used by the job condition, logged for diagnosis
+ const { user, author_association } = context.payload.pull_request;
+ core.info(`Author: ${user.login}, type: ${user.type},
author_association: ${author_association}`);
Review Comment:
Done in 21d535b
##########
.github/workflows/pr-check.yml:
##########
@@ -85,6 +89,23 @@ jobs:
const { data: pr } = await github.rest.pulls.get({ owner, repo,
pull_number: prNumber });
const hasDeclaration = regex.test(pr.body || '');
+ // Committers don't need the declaration.
+ // Note: private org members appear as CONTRIBUTOR in the event
payload,
+ // so we check write access via the API instead of relying on
author_association.
+ let hasWriteAccess = false;
+ try {
+ const { data: perm } = await
github.rest.repos.getCollaboratorPermissionLevel({
+ owner, repo, username: pr.user.login,
+ });
+ hasWriteAccess = ['admin', 'write'].includes(perm.permission);
Review Comment:
Done in 21d535b
##########
.github/workflows/pr-check.yml:
##########
@@ -85,6 +89,23 @@ jobs:
const { data: pr } = await github.rest.pulls.get({ owner, repo,
pull_number: prNumber });
const hasDeclaration = regex.test(pr.body || '');
+ // Committers don't need the declaration.
+ // Note: private org members appear as CONTRIBUTOR in the event
payload,
+ // so we check write access via the API instead of relying on
author_association.
+ let hasWriteAccess = false;
+ try {
+ const { data: perm } = await
github.rest.repos.getCollaboratorPermissionLevel({
+ owner, repo, username: pr.user.login,
+ });
+ hasWriteAccess = ['admin', 'write'].includes(perm.permission);
+ if (!hasWriteAccess) {
+ core.info(`Permission of ${pr.user.login}:
${perm.permission}`);
+ }
Review Comment:
Done in 21d535b
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]