π A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue awesomedashboarddockerhomelabhomepagemitnodejsorganizationproductivitypwaself-hostedstartpagevue
π§ Adds label/release config for release notes
Alicia Sykes45599ea67330
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdindex a6d00e23..85315bbd 100644--- a/.github/pull_request_template.md+++ b/.github/pull_request_template.md@@ -1,5 +1,5 @@### Category-<!-- Bugfix / Feature / Docs / Dependencies / Localization / Widget / Theme / Showcase -->+<!-- Bugfix / Feature / Docs / Dependencies / Localization / Widget / Theme / Showcase / CI -->### Overview<!-- Briefly outline your PR. Explain what was changed and why -->diff --git a/.github/release.yml b/.github/release.ymlnew file mode 100644index 00000000..7125cf53--- /dev/null+++ b/.github/release.yml@@ -0,0 +1,26 @@+# Groups merged PRs into sections in the auto-generated release notes,+# by the category labels applied in .github/workflows/label-pr.yml+# The first category a PR's labels match wins, so order matters here.++changelog:+ categories:+ - title: β¨ New Features+ labels: ['β¨ New Feature']+ - title: π¦ Bug Fixes+ labels: ['π¦ Bug Fix', 'π Hot Fix']+ - title: π Widgets+ labels: ['π Widget']+ - title: π¨ Themes and Styling+ labels: ['π¨ Theme', 'π Stylistic Changes']+ - title: π Localization+ labels: ['π Language']+ - title: π― Showcase+ labels: ['π― Showcase']+ - title: π Documentation+ labels: ['π Docs']+ - title: π οΈ Build, CI and Refactors+ labels: ['π οΈ Build Changes', 'π Refactor', 'ποΈ Architectural Changes']+ - title: π¦ Dependencies+ labels: ['π¦ Dependencies', 'dependencies']+ - title: π Other Changes+ labels: ['*']diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.ymlnew file mode 100644index 00000000..2e586566--- /dev/null+++ b/.github/workflows/label-pr.yml@@ -0,0 +1,70 @@+# Adds labels to PR based on category or files changed+# So that release notes can be categorized by change type++name: π·οΈ Label++on:+ pull_request_target: # zizmor: ignore[dangerous-triggers]+ types: [opened, edited]++concurrency:+ group: label-pr-${{ github.event.pull_request.number }}+ cancel-in-progress: true++permissions:+ contents: read+ pull-requests: write++jobs:+ label:+ name: π·οΈ Apply Category Label+ runs-on: ubuntu-latest+ continue-on-error: true+ steps:+ - name: Determine and Apply Label+ uses: actions/github-script@v9+ with:+ script: |+ // [ label, matches Category field, matches changed file paths ]+ const categories = [+ ['π Language', /localis|localiz|translat|i18n|language/i, /^src\/assets\/locales\//],+ ['π Widget', /widget/i, /^src\/(components|styles)\/[Ww]idgets\/|^docs\/widgets\.md$/],+ ['π¨ Theme', /theme|theming/i, /^src\/styles\/(themes\/|color-themes\.scss$)|^docs\/theming\.md$/],+ ['π― Showcase', /showcase/i, /^docs\/showcase/],+ ['π¦ Dependencies', /dependenc|deps/i, /^(yarn\.lock|package\.json)$/],+ ['π οΈ Build Changes', /build|\bci\b|workflow/i, /^\.github\/|^Dockerfile$|^vite\.config\.mjs$/],+ ['π Docs', /doc/i, /^docs\/|\.md$/],+ ['π¦ Bug Fix', /bug ?fix|^fix/i, null],+ ['β¨ New Feature', /feature|feat/i, null],+ ];++ const pr = context.payload.pull_request;+ const existing = pr.labels.map((l) => l.name);+ if (categories.some(([label]) => existing.includes(label))) {+ core.info('PR is already categorised, nothing to do');+ return;+ }++ // Read the Category field, ignoring the template's comment hints+ const body = (pr.body || '').replace(/<!--[\s\S]*?-->/g, '');+ const stated = (body.match(/#+\s*Category\s*([^\n#]*)/) || ['', ''])[1].trim();+ let labels = categories.filter(([, field]) => field.test(stated)).map(([label]) => label);++ // If no valid category was given, infer one from the files changed+ if (!labels.length) {+ const files = await github.paginate(github.rest.pulls.listFiles, {+ ...context.repo, pull_number: pr.number, per_page: 100,+ });+ const names = files.map((f) => f.filename);+ const counts = categories.map(([label, , paths]) =>+ [label, paths ? names.filter((n) => paths.test(n)).length : 0]);+ const [label, hits] = counts.reduce((a, b) => (b[1] > a[1] ? b : a));+ if (hits * 2 > names.length) labels = [label];+ }++ if (!labels.length) {+ core.info('Unable to determine a category for this PR');+ return;+ }+ await github.rest.issues.addLabels({ ...context.repo, issue_number: pr.number, labels });+ core.info(`Applied label(s): ${labels.join(', ')}`);