Unverified Commit 6ef7f5ec authored by Jan Kaifer's avatar Jan Kaifer Committed by GitHub

port `type: needs investigation` into linear (#44823)

Port it to Linear whenever we need investigation more investigation.

Tested on my fork.
parent 5f2809f4
...@@ -52,20 +52,24 @@ ...@@ -52,20 +52,24 @@
Object.defineProperty(p, '__esModule', { value: true }) Object.defineProperty(p, '__esModule', { value: true })
const s = r(a(5438)) const s = r(a(5438))
const i = r(a(2186)) const i = r(a(2186))
const o = { LINEAR: 'linear', KIND_BUG: 'kind: bug' } const o = {
LINEAR: 'linear',
KIND_BUG: 'kind: bug',
NEEDS_INVESTIGAGION: 'type: needs investigation',
}
const n = [o.KIND_BUG, o.NEEDS_INVESTIGAGION]
async function run() { async function run() {
try { try {
const { payload: e, repo: p } = s.context const { payload: e, repo: p } = s.context
const { const {
issue: a, issue: a,
pull_request: d, label: { name: d },
label: { name: t },
} = e } = e
if (d || !a?.body || !process.env.GITHUB_TOKEN) return if (!a || !process.env.GITHUB_TOKEN) return
const r = s.getOctokit(process.env.GITHUB_TOKEN).rest const t = s.getOctokit(process.env.GITHUB_TOKEN).rest
const i = { ...p, issue_number: a.number } const r = { ...p, issue_number: a.number }
if (t === o.KIND_BUG) { if (n.includes(d)) {
r.issues.addLabels({ ...i, labels: [o.LINEAR] }) t.issues.addLabels({ ...r, labels: [o.LINEAR] })
} }
} catch (e) { } catch (e) {
i.setFailed(e.message) i.setFailed(e.message)
...@@ -6240,8 +6244,8 @@ ...@@ -6240,8 +6244,8 @@
AbortError.prototype.constructor = AbortError AbortError.prototype.constructor = AbortError
AbortError.prototype.name = 'AbortError' AbortError.prototype.name = 'AbortError'
const A = r.URL || s.URL const A = r.URL || s.URL
const k = d.PassThrough const N = d.PassThrough
const N = function isDomainOrSubdomain(e, p) { const k = function isDomainOrSubdomain(e, p) {
const a = new A(p).hostname const a = new A(p).hostname
const d = new A(e).hostname const d = new A(e).hostname
return a === d || (a[a.length - d.length - 1] === '.' && a.endsWith(d)) return a === d || (a[a.length - d.length - 1] === '.' && a.endsWith(d))
...@@ -6374,7 +6378,7 @@ ...@@ -6374,7 +6378,7 @@
timeout: s.timeout, timeout: s.timeout,
size: s.size, size: s.size,
} }
if (!N(s.url, t)) { if (!k(s.url, t)) {
for (const e of [ for (const e of [
'authorization', 'authorization',
'www-authenticate', 'www-authenticate',
...@@ -6415,7 +6419,7 @@ ...@@ -6415,7 +6419,7 @@
e.once('end', function () { e.once('end', function () {
if (m) m.removeEventListener('abort', v) if (m) m.removeEventListener('abort', v)
}) })
let d = e.pipe(new k()) let d = e.pipe(new N())
const t = { const t = {
url: s.url, url: s.url,
status: e.statusCode, status: e.statusCode,
...@@ -6445,7 +6449,7 @@ ...@@ -6445,7 +6449,7 @@
return return
} }
if (i == 'deflate' || i == 'x-deflate') { if (i == 'deflate' || i == 'x-deflate') {
const p = e.pipe(new k()) const p = e.pipe(new N())
p.once('data', function (e) { p.once('data', function (e) {
if ((e[0] & 15) === 8) { if ((e[0] & 15) === 8) {
d = d.pipe(o.createInflate()) d = d.pipe(o.createInflate())
......
...@@ -4,23 +4,25 @@ import * as core from '@actions/core' ...@@ -4,23 +4,25 @@ import * as core from '@actions/core'
const LABELS = { const LABELS = {
LINEAR: 'linear', LINEAR: 'linear',
KIND_BUG: 'kind: bug', KIND_BUG: 'kind: bug',
NEEDS_INVESTIGAGION: 'type: needs investigation',
} }
const labelsPortedToLinear = [LABELS.KIND_BUG, LABELS.NEEDS_INVESTIGAGION]
async function run() { async function run() {
try { try {
const { payload, repo } = github.context const { payload, repo } = github.context
const { const {
issue, issue,
pull_request,
label: { name: newLabel }, label: { name: newLabel },
} = payload } = payload
if (pull_request || !issue?.body || !process.env.GITHUB_TOKEN) return if (!issue || !process.env.GITHUB_TOKEN) return
const client = github.getOctokit(process.env.GITHUB_TOKEN).rest const client = github.getOctokit(process.env.GITHUB_TOKEN).rest
const issueCommon = { ...repo, issue_number: issue.number } const issueCommon = { ...repo, issue_number: issue.number }
if (newLabel === LABELS.KIND_BUG) { if (labelsPortedToLinear.includes(newLabel)) {
client.issues.addLabels({ client.issues.addLabels({
...issueCommon, ...issueCommon,
labels: [LABELS.LINEAR], labels: [LABELS.LINEAR],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment