Skip to content

Commit

Permalink
fix: switched to simple array for adding labels
Browse files Browse the repository at this point in the history
Documentation is very incomplete on how to do this it seems...
  • Loading branch information
arctic-hen7 committed Jan 8, 2022
1 parent 1f80431 commit b84bf4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
11 changes: 4 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90794,7 +90794,6 @@ const newIssueHandler = async (ctx) => {
const { data } = await ctx.octokit.issues.get(params);
// Get the labels out of that
let labels = getRequestedLabels(data.body);
console.log(labels);
// If we didn't find the appropriate formatting, we'll get `undefined`, in which case this issue wasn't created with Tribble and we should shut up
if (labels === undefined) {
return;
Expand All @@ -90816,8 +90815,6 @@ const getRequestedLabels = (issueBody) => {
// We add to this because we need to get the actual contained text
const detailsOpenIdx = issueBody.lastIndexOf("</summary>") + 10;
const detailsCloseIdx = issueBody.lastIndexOf("</details>");
console.log(detailsOpenIdx);
console.log(detailsCloseIdx);
// The indexing will return `-1` if it found nothing (but one had 10 added)
if (detailsOpenIdx === 9 || detailsCloseIdx === -1) {
return undefined;
Expand All @@ -90832,19 +90829,19 @@ const getRequestedLabels = (issueBody) => {
return { name };
});

return githubLabels;
return labels;
};

const test = (/* unused pure expression or super */ null && (`This report is reporting a bug. Description: test. Boolean: true
const test = `This report is reporting a bug. Description: test. Boolean: true

<details>
<summary>Tribble internal data</summary>

YnVnLHdvbnRmaXg=

</details>`));
</details>`;

// console.log(getRequestedLabels(test));
console.log(getRequestedLabels(test));


/***/ }),
Expand Down
7 changes: 2 additions & 5 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const newIssueHandler = async (ctx) => {
const { data } = await ctx.octokit.issues.get(params);
// Get the labels out of that
let labels = getRequestedLabels(data.body);
console.log(labels);
// If we didn't find the appropriate formatting, we'll get `undefined`, in which case this issue wasn't created with Tribble and we should shut up
if (labels === undefined) {
return;
Expand All @@ -33,8 +32,6 @@ const getRequestedLabels = (issueBody) => {
// We add to this because we need to get the actual contained text
const detailsOpenIdx = issueBody.lastIndexOf("</summary>") + 10;
const detailsCloseIdx = issueBody.lastIndexOf("</details>");
console.log(detailsOpenIdx);
console.log(detailsCloseIdx);
// The indexing will return `-1` if it found nothing (but one had 10 added)
if (detailsOpenIdx === 9 || detailsCloseIdx === -1) {
return undefined;
Expand All @@ -49,7 +46,7 @@ const getRequestedLabels = (issueBody) => {
return { name };
});

return githubLabels;
return labels;
};

const test = `This report is reporting a bug. Description: test. Boolean: true
Expand All @@ -61,4 +58,4 @@ YnVnLHdvbnRmaXg=
</details>`;

// console.log(getRequestedLabels(test));
console.log(getRequestedLabels(test));

0 comments on commit b84bf4c

Please sign in to comment.