Skip to content

Commit

Permalink
[infra] Fix regex in order id validation (#13976)
Browse files Browse the repository at this point in the history
  • Loading branch information
michelengelen committed Jul 25, 2024
1 parent b795564 commit 0fb15c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/orderIdValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ module.exports = async ({ core, context, github }) => {
});
const orderDetails = await order.json();
const plan =
orderDetails.line_items?.filter((item) => item.name.test(/\b(pro|premium)\b/i))[0].name ||
orderDetails.line_items?.filter((item) => /\b(pro|premium)\b/i.test(item.name))[0].name ||
'';

if (!plan) {
core.setFailed('No Pro or Premium plan found in order');
core.info('No Pro or Premium plan found in order');
return;
}

const planName = plan.match(/\b(pro|premium)\b/i)[0].toLowerCase();
Expand Down

0 comments on commit 0fb15c6

Please sign in to comment.