Don't treat Dependabot as community contributor (https://github.com/woocommerce/woocommerce-blocks/pull/9254)

* Test commit

* Don't treat dependabot as a community

* Remove unwanted change

* Make the check for ignored usernames clearer
This commit is contained in:
Karol Manijak 2023-06-19 08:49:59 +02:00 committed by GitHub
parent eec844f447
commit 115ccca4f9
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,10 @@ const core = require( '@actions/core' );
// this won't work. // this won't work.
const octokit = new Octokit(); const octokit = new Octokit();
const ignoredUsernames = [ 'dependabot' ];
const checkIfIgnoredUsername = ( username ) =>
ignoredUsernames.includes( username );
const getIssueAuthor = ( payload ) => { const getIssueAuthor = ( payload ) => {
return ( return (
payload?.issue?.user?.login || payload?.issue?.user?.login ||
@ -15,7 +19,7 @@ const getIssueAuthor = ( payload ) => {
}; };
const isCommunityContributor = async ( owner, repo, username ) => { const isCommunityContributor = async ( owner, repo, username ) => {
if ( username ) { if ( username && ! checkIfIgnoredUsername( username ) ) {
const { const {
data: { permission }, data: { permission },
} = await octokit.rest.repos.getCollaboratorPermissionLevel( { } = await octokit.rest.repos.getCollaboratorPermissionLevel( {