Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA][TS migration] Migrate 'reviewerChecklist.js', 'getReleaseBody.js', 'getPreviousVersion.js' and 'checkDeployBlockers.js' .github files to Typescript #39197

Merged
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// eslint-disable-next-line import/no-import-module-exports
/* eslint-disable @typescript-eslint/naming-convention */
import * as core from '@actions/core';
import CONST from '@github/libs/CONST';

const _ = require('underscore');
const core = require('@actions/core');
const GithubUtils = require('../../../libs/GithubUtils');
import GithubUtils from '@github/libs/GithubUtils';
import {isEmptyObject} from '@src/types/utils/EmptyObject';

const run = function () {
const issueNumber = Number(core.getInput('ISSUE_NUMBER', {required: true}));
Expand All @@ -21,7 +20,7 @@ const run = function () {

// Check the issue description to see if there are any unfinished/un-QAed items in the checklist.
const uncheckedBoxRegex = /-\s\[\s]\s/;
if (uncheckedBoxRegex.test(data.body)) {
if (uncheckedBoxRegex.test(data.body ?? '')) {
console.log('An unverified PR or unresolved deploy blocker was found.');
core.setOutput('HAS_DEPLOY_BLOCKERS', true);
return;
Expand All @@ -39,12 +38,12 @@ const run = function () {

// If comments is undefined that means we found an unchecked QA item in the
// issue description, so there's nothing more to do but return early.
if (_.isUndefined(comments)) {
if (comments === undefined) {
return;
}

// If there are no comments, then we have not yet gotten the :shipit: seal of approval.
if (_.isEmpty(comments.data)) {
if (isEmptyObject(comments.data)) {
console.log('No comments found on issue');
core.setOutput('HAS_DEPLOY_BLOCKERS', true);
return;
Expand All @@ -53,7 +52,7 @@ const run = function () {
console.log('Verifying that the last comment is the :shipit: seal of approval');
const lastComment = comments.data.pop();
const shipItRegex = /^:shipit:/g;
if (_.isNull(shipItRegex.exec(lastComment.body))) {
if (!shipItRegex.exec(lastComment?.body ?? '')) {
console.log('The last comment on the issue was not :shipit');
pac-guerreiro marked this conversation as resolved.
Show resolved Hide resolved
core.setOutput('HAS_DEPLOY_BLOCKERS', true);
} else {
Expand Down
Loading
Loading