Repository navigation
Card Save leaves focus on body after Enter #359
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Issue labels | |
| on: | |
| issues: | |
| types: [opened, edited] | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Apply area labels | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const text = `${issue.title}\n${issue.body || ''}`.toLowerCase().replace(/https?:\/\/\S+/g, ' '); | |
| const rules = new Map([ | |
| ['area:artwork', ['artwork', 'cover', 'image']], | |
| ['area:cards', ['card', 'svg', 'readme']], | |
| ['area:ci', ['ci', 'workflow', 'action', 'dependabot', 'renovate', 'codeql']], | |
| ['area:discord', ['discord', 'rich presence', 'ipc']], | |
| ['area:docs', ['docs', 'documentation', 'guide', 'wiki']], | |
| ['area:installer', ['install', 'windows', 'setup', 'configuration', 'config migration']], | |
| ['area:providers', ['provider', 'plex', 'jellyfin', 'navidrome', 'emby', 'spotify', 'youtube']], | |
| ['area:release', ['release', 'provenance', 'sbom', 'package']], | |
| ['area:security', ['security', 'privacy', 'secret', 'credential', 'token']], | |
| ['area:server', ['server', 'http', 'hosted', 'cache', 'health']], | |
| ['area:tray', ['tray', 'diagnostic', 'log folder', 'safe mode']], | |
| ['area:updater', ['update', 'upgrade']], | |
| ]); | |
| const labels = [...rules] | |
| .filter(([, words]) => words.some((word) => new RegExp(`(^|[^a-z0-9])${word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}([^a-z0-9]|$)`, 'i').test(text))) | |
| .map(([label]) => label); | |
| if (!labels.length) return; | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| labels, | |
| }); |