@@ -8929,17 +8929,25 @@ const versionLabel = "Version: ";
8929
8929
const versionTitlesInMarkdown = ["Version", "New Version"];
8930
8930
const rnInfoTitleInMarkdown = "Output of `react-native info`";
8931
8931
const labelForNoVersion = "Version: unspecified";
8932
+ function isTokenWithText(token) {
8933
+ return !!(token === null || token === void 0 ? void 0 : token.text);
8934
+ }
8932
8935
const getVersionFromIssueBody = (issueBody) => {
8933
8936
let versionFromIssueBody = "";
8934
8937
// Parse the markdown from the issue body
8935
8938
const markdownSection = marked_1.marked.lexer(issueBody);
8936
8939
// Loop through all sections
8937
8940
for (const markdownSectionIndex in markdownSection) {
8941
+ // Skip sections that don't contain text
8942
+ const currentSection = markdownSection[markdownSectionIndex];
8943
+ if (!isTokenWithText(currentSection)) {
8944
+ continue;
8945
+ }
8938
8946
// If this section matches `versionTitleInMarkdown`
8939
- if (versionTitlesInMarkdown.includes(markdownSection[markdownSectionIndex] .text)) {
8947
+ if (versionTitlesInMarkdown.includes(currentSection .text)) {
8940
8948
// Then the version can be found in the next section
8941
8949
const specifiedVersion = markdownSection[Number(markdownSectionIndex) + 1];
8942
- if (!specifiedVersion.text ) {
8950
+ if (!isTokenWithText( specifiedVersion) ) {
8943
8951
continue;
8944
8952
}
8945
8953
const parsedVersion = (0, parse_1.default)(specifiedVersion.text);
@@ -8950,11 +8958,10 @@ const getVersionFromIssueBody = (issueBody) => {
8950
8958
break;
8951
8959
}
8952
8960
// If this section matches `rnInfoTitleInMarkdown`
8953
- if (markdownSection[markdownSectionIndex].text ===
8954
- rnInfoTitleInMarkdown) {
8961
+ if (currentSection.text === rnInfoTitleInMarkdown) {
8955
8962
// Then the version can be found in the next section
8956
8963
const rnInfoOutput = markdownSection[Number(markdownSectionIndex) + 1];
8957
- if (!rnInfoOutput.text ) {
8964
+ if (!isTokenWithText( rnInfoOutput) ) {
8958
8965
continue;
8959
8966
}
8960
8967
const rnInfoRNPart = rnInfoOutput.text.match(/react-native:(.+?)=>/);
@@ -9001,6 +9008,10 @@ const init = () => __awaiter(void 0, void 0, void 0, function* () {
9001
9008
repo: issue.repo,
9002
9009
issue_number: issue.number,
9003
9010
});
9011
+ if (labels.every(({ name }) => name !== "pre-release")) {
9012
+ core.debug("Issue not tagged with pre-release");
9013
+ return;
9014
+ }
9004
9015
// Loop through all labels and remove the version label if it exists
9005
9016
// and is not the same as the version from the issue body
9006
9017
try {
0 commit comments