mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-23 17:52:23 -04:00
Chore: improve PR labeling move all labelling to pr-bot workflow (#9970)
This commit is contained in:
parent
0a03ca94c7
commit
e092627da6
7
.github/labeler.yml
vendored
7
.github/labeler.yml
vendored
@ -17,3 +17,10 @@ ci-cd:
|
|||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file:
|
- any-glob-to-any-file:
|
||||||
- '.github/**'
|
- '.github/**'
|
||||||
|
# pr types
|
||||||
|
bug:
|
||||||
|
- head-branch:
|
||||||
|
- ['^fix']
|
||||||
|
enhancement:
|
||||||
|
- head-branch:
|
||||||
|
- ['^feature']
|
||||||
|
14
.github/release-drafter.yml
vendored
14
.github/release-drafter.yml
vendored
@ -1,15 +1,3 @@
|
|||||||
autolabeler:
|
|
||||||
- label: "bug"
|
|
||||||
branch:
|
|
||||||
- '/^fix/'
|
|
||||||
title:
|
|
||||||
- "/^fix/i"
|
|
||||||
- "/^Bugfix/i"
|
|
||||||
- label: "enhancement"
|
|
||||||
branch:
|
|
||||||
- '/^feature/'
|
|
||||||
title:
|
|
||||||
- "/^feature/i"
|
|
||||||
categories:
|
categories:
|
||||||
- title: 'Breaking Changes'
|
- title: 'Breaking Changes'
|
||||||
labels:
|
labels:
|
||||||
@ -17,7 +5,7 @@ categories:
|
|||||||
- title: 'Notable Changes'
|
- title: 'Notable Changes'
|
||||||
labels:
|
labels:
|
||||||
- 'notable'
|
- 'notable'
|
||||||
- title: 'Features'
|
- title: 'Features / Enhancements'
|
||||||
labels:
|
labels:
|
||||||
- 'enhancement'
|
- 'enhancement'
|
||||||
- title: 'Bug Fixes'
|
- title: 'Bug Fixes'
|
||||||
|
28
.github/workflows/pr-bot.yml
vendored
28
.github/workflows/pr-bot.yml
vendored
@ -10,7 +10,8 @@ jobs:
|
|||||||
name: Automated PR Bot
|
name: Automated PR Bot
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Label by file path
|
- name: Label PR by file path or branch name
|
||||||
|
# see .github/labeler.yml for the labeler config
|
||||||
uses: actions/labeler@v5
|
uses: actions/labeler@v5
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@ -24,6 +25,31 @@ jobs:
|
|||||||
s_diff: '99999'
|
s_diff: '99999'
|
||||||
fail_if_xl: 'false'
|
fail_if_xl: 'false'
|
||||||
excluded_files: /\.lock$/ /\.txt$/ ^src-ui/pnpm-lock\.yaml$ ^src-ui/messages\.xlf$ ^src/locale/en_US/LC_MESSAGES/django\.po$
|
excluded_files: /\.lock$/ /\.txt$/ ^src-ui/pnpm-lock\.yaml$ ^src-ui/messages\.xlf$ ^src/locale/en_US/LC_MESSAGES/django\.po$
|
||||||
|
- name: Label by PR title
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const pr = context.payload.pull_request;
|
||||||
|
const title = pr.title.toLowerCase();
|
||||||
|
const labels = [];
|
||||||
|
|
||||||
|
if (/^(fix|bugfix)/i.test(title)) {
|
||||||
|
labels.push('bug');
|
||||||
|
} else if (/^feature/i.test(title)) {
|
||||||
|
labels.push('enhancement');
|
||||||
|
} else {
|
||||||
|
labels.push('enhancement'); // Default fallback
|
||||||
|
}
|
||||||
|
|
||||||
|
if (labels.length) {
|
||||||
|
await github.rest.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: pr.number,
|
||||||
|
labels,
|
||||||
|
});
|
||||||
|
core.info(`Added labels based on title: ${labels.join(', ')}`);
|
||||||
|
}
|
||||||
- name: Label bot-generated PRs
|
- name: Label bot-generated PRs
|
||||||
if: ${{ contains(github.actor, 'dependabot') || contains(github.actor, 'crowdin-bot') }}
|
if: ${{ contains(github.actor, 'dependabot') || contains(github.actor, 'crowdin-bot') }}
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user