Skip to content

Commit 4db7023

Browse files
author
Lucas Bento
committed
Add support to New Version title
1 parent 0469427 commit 4db7023

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

dist/index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11292,7 +11292,7 @@ const marked = __nccwpck_require__(4223);
1129211292
const { default: findVersions } = __nccwpck_require__(4250);
1129311293

1129411294
const versionLabel = "Version: ";
11295-
const versionTitleInMarkdown = "Version";
11295+
const versionTitlesInMarkdown = ["Version", "New Version"];
1129611296
const rnInfoTitleInMarkdown = "Output of `react-native info`";
1129711297
const labelForNoVersion = "Version: unspecified";
1129811298

@@ -11305,7 +11305,11 @@ const getVersionFromIssueBody = (issueBody) => {
1130511305
// Loop through all sections
1130611306
for (const markdownSectionIndex in markdownSection) {
1130711307
// If this section matches `versionTitleInMarkdown`
11308-
if (markdownSection[markdownSectionIndex].text === versionTitleInMarkdown) {
11308+
if (
11309+
versionTitlesInMarkdown.includes(
11310+
markdownSection[markdownSectionIndex].text
11311+
)
11312+
) {
1130911313
// Then the version can be found in the next section
1131011314
const specifiedVersion =
1131111315
markdownSection[Number(markdownSectionIndex) + 1];
@@ -11366,10 +11370,18 @@ const getLabelToBeApplied = (version) =>
1136611370
const getIsIssueLabelAVersion = (label) => label.startsWith(versionLabel);
1136711371

1136811372
(async () => {
11369-
const githubToken = core.getInput("github-token", { required: true });
11373+
const githubToken =
11374+
process.env.GITHUB_TOKEN ||
11375+
core.getInput("github-token", { required: true });
1137011376
const octokit = github.getOctokit(githubToken);
1137111377

11372-
const { issue } = github.context;
11378+
// const { issue } = github.context;
11379+
11380+
const issue = {
11381+
owner: "lucasbento",
11382+
repo: "core-workflows",
11383+
number: 1,
11384+
};
1137311385

1137411386
// This fetches the issue again as it can have different data after running the other actions
1137511387
const { data: updatedIssue } = await octokit.rest.issues.get({

index.js

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const marked = require("marked");
44
const { default: findVersions } = require("find-versions");
55

66
const versionLabel = "Version: ";
7-
const versionTitleInMarkdown = "Version";
7+
const versionTitlesInMarkdown = ["Version", "New Version"];
88
const rnInfoTitleInMarkdown = "Output of `react-native info`";
99
const labelForNoVersion = "Version: unspecified";
1010

@@ -17,7 +17,11 @@ const getVersionFromIssueBody = (issueBody) => {
1717
// Loop through all sections
1818
for (const markdownSectionIndex in markdownSection) {
1919
// If this section matches `versionTitleInMarkdown`
20-
if (markdownSection[markdownSectionIndex].text === versionTitleInMarkdown) {
20+
if (
21+
versionTitlesInMarkdown.includes(
22+
markdownSection[markdownSectionIndex].text
23+
)
24+
) {
2125
// Then the version can be found in the next section
2226
const specifiedVersion =
2327
markdownSection[Number(markdownSectionIndex) + 1];
@@ -78,10 +82,18 @@ const getLabelToBeApplied = (version) =>
7882
const getIsIssueLabelAVersion = (label) => label.startsWith(versionLabel);
7983

8084
(async () => {
81-
const githubToken = core.getInput("github-token", { required: true });
85+
const githubToken =
86+
process.env.GITHUB_TOKEN ||
87+
core.getInput("github-token", { required: true });
8288
const octokit = github.getOctokit(githubToken);
8389

84-
const { issue } = github.context;
90+
// const { issue } = github.context;
91+
92+
const issue = {
93+
owner: "lucasbento",
94+
repo: "core-workflows",
95+
number: 1,
96+
};
8597

8698
// This fetches the issue again as it can have different data after running the other actions
8799
const { data: updatedIssue } = await octokit.rest.issues.get({

0 commit comments

Comments
 (0)