exclude dependabot from commmunity contributor label (#44861)
* exclude dependabot from commmunity contributor label * use prior art from block repo --------- Co-authored-by: Ron Rennick <ronald.rennick@automattic.com>
This commit is contained in:
parent
6524f639b4
commit
d1afc4abe4
|
@ -6,6 +6,10 @@ const core = require( '@actions/core' );
|
|||
// this won't work.
|
||||
const octokit = new Octokit();
|
||||
|
||||
const ignoredUsernames = [ 'dependabot[bot]' ];
|
||||
const checkIfIgnoredUsername = ( username ) =>
|
||||
ignoredUsernames.includes( username );
|
||||
|
||||
const getIssueAuthor = ( payload ) => {
|
||||
return (
|
||||
payload?.issue?.user?.login ||
|
||||
|
@ -15,7 +19,7 @@ const getIssueAuthor = ( payload ) => {
|
|||
};
|
||||
|
||||
const isCommunityContributor = async ( owner, repo, username ) => {
|
||||
if ( username ) {
|
||||
if ( username && ! checkIfIgnoredUsername( username ) ) {
|
||||
const {
|
||||
data: { permission },
|
||||
} = await octokit.rest.repos.getCollaboratorPermissionLevel( {
|
||||
|
@ -27,6 +31,7 @@ const isCommunityContributor = async ( owner, repo, username ) => {
|
|||
return permission === 'read' || permission === 'none';
|
||||
}
|
||||
|
||||
console.log( 'Not a community contributor!' );
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue