Update scripts

This commit is contained in:
freearhey
2025-10-22 02:27:22 +03:00
parent f701e0b830
commit 0b046f1f3c
50 changed files with 1655 additions and 2367 deletions

View File

@@ -1,24 +1,47 @@
import { Dictionary } from '@freearhey/core'
import { OWNER, REPO } from '../constants'
interface IssueProps {
number: number
labels: string[]
data: Dictionary
}
export class Issue {
number: number
labels: string[]
data: Dictionary
constructor({ number, labels, data }: IssueProps) {
this.number = number
this.labels = labels
this.data = data
}
getURL() {
return `https://github.com/${OWNER}/${REPO}/issues/${this.number}`
}
}
import { EOL, OWNER, REPO } from '../constants'
import { Dictionary } from '@freearhey/core'
const FIELDS = new Dictionary({
Site: 'site'
})
interface IssueData {
number: number
body: string
labels: { name: string }[]
}
export class Issue {
number: number
labels: string[]
data: Dictionary<string>
constructor(issue: IssueData) {
const fields = typeof issue.body === 'string' ? issue.body.split('###') : []
this.data = new Dictionary<string>()
fields.forEach((field: string) => {
const parsed = field.split(/\r?\n/).filter(Boolean)
let _label = parsed.shift()
_label = _label ? _label.trim() : ''
let _value = parsed.join(EOL)
_value = _value ? _value.trim() : ''
if (!_label || !_value) return
const id: string | undefined = FIELDS.get(_label)
const value: string = _value === '_No response_' || _value === 'None' ? '' : _value
if (!id) return
this.data.set(id, value)
})
this.labels = issue.labels.map(label => label.name)
this.number = issue.number
}
getURL() {
return `https://github.com/${OWNER}/${REPO}/issues/${this.number}`
}
}