Skip to content

Commit

Permalink
Ignore PRs with given labels
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Jan 19, 2024
1 parent 39ec158 commit 5bff9d0
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions bin/generate-php-sync-issue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ const OWNER = 'wordpress';
const REPO = 'gutenberg';
const MAX_MONTHS_TO_QUERY = 4;

// The following paths will be ignored when generating the issue content.
const IGNORED_PATHS = [
'lib/load.php', // plugin specific code.
'lib/experiments-page.php', // experiments are plugin specific.
'packages/e2e-tests/plugins', // PHP files related to e2e tests only.
'packages/block-library', // this is handled automatically.
];

const MAX_NESTING_LEVEL = 3;
// PRs containing the following labels will be ignored when generating the issue content.
const LABELS_TO_IGNORE = [ 'Backport from WordPress Core' ];

const DEBUG = !! getArg( 'debug' );
const MAX_NESTING_LEVEL = 3;

const __filename = fileURLToPath( import.meta.url );
const __dirname = dirname( __filename );
Expand Down Expand Up @@ -94,10 +96,6 @@ async function main() {

console.log( 'Welcome to the PHP Sync Issue Generator!' );

if ( DEBUG ) {
console.log( 'DEBUG MODE' );
}

console.log( '--------------------------------' );
console.log( '• Running script...' );

Expand Down Expand Up @@ -139,7 +137,7 @@ async function main() {
// using getPullRequestDataForCommit, but that requires yet another
// network request. Therefore we optimise for trying to build
// the PR URL from the commit data we have available.
const pullRequest = {
commitData.pullRequest = {
url: fullPRData?.html_url || buildPRURL( commit ),
creator:
fullPRData?.user?.login ||
Expand All @@ -148,8 +146,14 @@ async function main() {
labels: fullPRData?.labels || [],
};

if ( pullRequest ) {
commitData.pullRequest = pullRequest;
// if the PR labels contain any of the labels to ignore, skip this commit
// by returning null.
if (
commitData.pullRequest.labels.some( ( label ) =>
LABELS_TO_IGNORE.includes( label.name )
)
) {
return null;
}

// This is temporarily required because PRs merged between Beta 1 (since)
Expand Down

0 comments on commit 5bff9d0

Please sign in to comment.