diff --git a/.github/scripts/issues.cjs b/.github/scripts/issues.cjs deleted file mode 100644 index 116151404..000000000 --- a/.github/scripts/issues.cjs +++ /dev/null @@ -1,54 +0,0 @@ -// @ts-check - -/** @param {import('github-script').AsyncFunctionArguments} args */ -function addPriorityAndDifficulty({ context, github }) { - /** @type {(item: string) => string | null} */ - const extractItem = (item) => { - const items = context.payload.issue?.body?.split('\n\n'); - const labelIndex = items?.findIndex((s) => s.includes(item)); - if (labelIndex === undefined || labelIndex === -1) { - return null; - } - return items?.[labelIndex + 1] ?? null; - }; - const priority = extractItem('Priority'); - const difficulty = extractItem('Estimated Difficulty'); - - const labels = []; - if (priority) { - labels.push(`Priority: ${priority}`); - } - if (difficulty) { - labels.push(`Difficulty: ${difficulty}`); - } - - github.rest.issues.addLabels({ - issue_number: context.issue.number, - labels: labels, - owner: context.repo.owner, - repo: context.repo.repo - }); -} - -/** @param {import('github-script').AsyncFunctionArguments} args */ -function addLabelToTitle({ context, github }) { - const title = context.payload.issue?.title; - const names = ['Bug', 'Feature', 'Enhancement', 'Discussion']; - const kind = context.payload.issue?.labels.find((item) => names.includes(item.name))?.name; - if (!kind) { - console.error('Does not match kind'); - return; - } - github.rest.issues.update({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - title: `[${kind}]: ${title}` - }); -} - -/** @param {import('github-script').AsyncFunctionArguments} args */ -module.exports = (args) => { - addPriorityAndDifficulty(args); - addLabelToTitle(args); -}; diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml deleted file mode 100644 index cf925c486..000000000 --- a/.github/workflows/issues.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Issues -on: - issues: - types: - - reopened - - opened -permissions: - contents: read - issues: write -jobs: - label: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v7 - - name: Run Script - uses: actions/github-script@v9 - with: - script: | - require('./.github/scripts/issues.cjs')()