Skip to content

Commit

Permalink
feat: allow no label area prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
balazsorban44 committed Apr 17, 2024
1 parent 7e7274b commit f25358b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const config = {
'{"invalid reproduction": ".github/invalid-reproduction.md"}'
),
areaSection: getInput("label_area_section"),
areaPrefix: getInput("label_area_prefix") || "area:",
areaPrefix: getInput("label_area_prefix") ?? "area:",
},
comments: {
unhelpfulWeight: Number(getInput("comment_unhelpful_weight")) || 0.3,
Expand Down Expand Up @@ -154,8 +154,8 @@ async function isValidReproduction(body) {

try {
// Verify that the link can be opened
const { status } = await fetch(getFetchLink(link))
// We allow 500, in case it's a downtime
const { status } = await fetch(link)
const ok = status < 400 || status >= 500
if (!ok) info(`Link returned status ${status}`)
return ok
Expand All @@ -165,6 +165,17 @@ async function isValidReproduction(body) {
}
}

/**
* HACK: Codesandbox devboxes currently always return a 200 status code, even if the sandbox is not found.
* We need to use the API to verify if the sandbox exists.
* @param {string} link
*/
function getFetchLink(link) {
if (link.startsWith("https://codesandbox.com"))
return link.replace("/p/devbox/", "/api/v1/sandboxes/")
return link
}

/**
* Return either a file's content or a string
* @param {string} pathOrComment
Expand Down

0 comments on commit f25358b

Please sign in to comment.