Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

ci: add automatic labeling for pull requests and issues

adnan-bhaldar19be3dfc400e
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 00000000..af0cca23
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,22 @@
+build:
+ - changed-files:
+ - any-glob-to-any-file:
+ - build/**
+ - installer/**
+ - .github/workflows/**
+ - global.json
+
+documentation:
+ - changed-files:
+ - all-globs-to-all-files:
+ - '{docs/**,**/*.md}'
+
+formats:
+ - changed-files:
+ - any-glob-to-any-file:
+ - src/Filee.Engines/**
+
+translation:
+ - changed-files:
+ - all-globs-to-all-files:
+ - src/Filee.App/Assets/i18n/**
\ No newline at end of file
diff --git a/.github/workflows/label-issue.yml b/.github/workflows/label-issue.yml
new file mode 100644
index 00000000..ab5302fd
--- /dev/null
+++ b/.github/workflows/label-issue.yml
@@ -0,0 +1,39 @@
+name: Label issues
+
+on:
+ issues:
+ types: [opened]
+
+permissions:
+ issues: write
+
+jobs:
+ label:
+ runs-on: ubuntu-24.04
+ steps:
+ - uses: actions/github-script@v9
+ with:
+ script: |
+ const issue = context.payload.issue;
+ if (issue.labels.length) return; // already labeled, e.g. by an issue form
+
+ const title = issue.title.toLowerCase();
+ const rules = [
+ [/\b(bug|crash(es|ed)?|error|exception|fail(s|ed|ure)?|broken|freez(e|es)|hang(s)?|not working|doesn'?t work)\b/, 'bug'],
+ [/\b(feature request|enhancement|improve(ment)?|suggestion|would be nice|please add)\b/, 'enhancement'],
+ [/\b(add support|support for|new format|new engine)\b/, 'formats'],
+ [/\b(docs?|documentation|readme|typo)\b/, 'documentation'],
+ [/\b(translation|translate|localization|localisation|i18n|l10n)\b/, 'translation'],
+ [/\b(accessibility|a11y|screen reader|high contrast|narrator|nvda)\b/, 'accessibility'],
+ [/\b(installer|msix)\b/, 'build'],
+ [/\?\s*$|^(how|why|what|can|is|does)\b/, 'question'],
+ ];
+ const labels = rules.filter(([re]) => re.test(title)).map(([, label]) => label);
+ if (labels.length) {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: issue.number,
+ labels,
+ });
+ }
diff --git a/.github/workflows/label-pr.yml b/.github/workflows/label-pr.yml
new file mode 100644
index 00000000..1a416a21
--- /dev/null
+++ b/.github/workflows/label-pr.yml
@@ -0,0 +1,38 @@
+name: Label pull requests
+
+on:
+ pull_request_target:
+ types: [opened, reopened, synchronize, edited]
+
+permissions:
+ contents: read
+ pull-requests: write
+
+jobs:
+ label:
+ runs-on: ubuntu-24.04
+ steps:
+ # By changed files, using .github/labeler.yml. Labels are only added, never removed.
+ - uses: actions/labeler@v6
+
+ # By title prefix: "feat: ...", "fix: ...", "docs: ...", "ci: ...".
+ - uses: actions/github-script@v9
+ with:
+ script: |
+ const title = context.payload.pull_request.title.toLowerCase();
+ const rules = [
+ [/^feat(\(.+\))?!?:/, 'feature'],
+ [/^fix(\(.+\))?!?:/, 'bug'],
+ [/^docs(\(.+\))?!?:/, 'documentation'],
+ [/^(ci|build)(\(.+\))?!?:/, 'build'],
+ [/^(i18n|l10n)(\(.+\))?!?:/, 'translation'],
+ ];
+ const labels = rules.filter(([re]) => re.test(title)).map(([, label]) => label);
+ if (labels.length) {
+ await github.rest.issues.addLabels({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ issue_number: context.payload.pull_request.number,
+ labels,
+ });
+ }
\ No newline at end of file