Some checks failed
Documentation / Build and Deploy Documentation (push) Successful in 1m8s
Checks / Prek / Pre-commit & Formatting (push) Successful in 1m23s
Checks / Prek / Clippy and Cargo Tests (push) Successful in 8m1s
Release Docker Image / Build linux-amd64 (release) (push) Successful in 15m7s
Release Docker Image / Build linux-arm64 (release) (push) Successful in 9m56s
Release Docker Image / Create Multi-arch Release Manifest (push) Successful in 42s
Release Docker Image / Build linux-arm64 (max-perf) (push) Failing after 3m17s
Release Docker Image / Build linux-amd64 (max-perf) (push) Successful in 35m59s
Release Docker Image / Create Max-Perf Manifest (push) Has been skipped
Release Docker Image / Mirror Images (push) Has been skipped
53 lines
1.8 KiB
YAML
53 lines
1.8 KiB
YAML
name: Auto Labeler
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, reopened]
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
auto-label:
|
|
name: Apply labels based on changed files
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Apply PR Labels
|
|
uses: https://github.com/actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
|
with:
|
|
script: |
|
|
const allFiles = await github.paginate(github.rest.pulls.listFiles, {
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
pull_number: context.issue.number,
|
|
});
|
|
|
|
const fileNames = allFiles.map(f => f.filename);
|
|
const labelsToAdd = new Set();
|
|
|
|
for (const file of fileNames) {
|
|
if (file.startsWith('docs/') || file.startsWith('theme/') || file.endsWith('.md') || file == 'rspress.config.ts') {
|
|
labelsToAdd.add('Documentation');
|
|
}
|
|
if (file.startsWith('.forgejo/')) {
|
|
labelsToAdd.add('Meta/CI');
|
|
}
|
|
if (file.startsWith('pkg/') || file.startsWith('nix/') || file === 'flake.nix' || file === 'flake.lock' || file.startsWith('docker/')) {
|
|
labelsToAdd.add('Meta/Packaging');
|
|
}
|
|
}
|
|
|
|
if (labelsToAdd.size > 0) {
|
|
const labelsArray = Array.from(labelsToAdd);
|
|
console.log('Adding labels:', labelsArray);
|
|
await github.rest.issues.addLabels({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
labels: labelsArray,
|
|
});
|
|
} else {
|
|
console.log('No files changed that require auto-labeling.');
|
|
}
|