Skip to content

feat: complete Python and Node.js bindings for all namespaces #54

feat: complete Python and Node.js bindings for all namespaces

feat: complete Python and Node.js bindings for all namespaces #54

Workflow file for this run

name: Auto Label PR
# Automatically add labels to pull requests based on changed files
# Uses the labeler.yml configuration file
permissions:
contents: read
pull-requests: write
on:
pull_request_target:
types: [opened, synchronize, reopened]
jobs:
label:
name: Label PR
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: write
steps:
- name: Auto-label based on changed files
uses: actions/labeler@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/labeler.yml
sync-labels: false # Don't remove labels
- name: Add size label
uses: actions/github-script@v8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const additions = pr.additions;
const deletions = pr.deletions;
const totalChanges = additions + deletions;
// Calculate size category
let sizeLabel = '';
if (totalChanges < 10) {
sizeLabel = 'size: XS';
} else if (totalChanges < 50) {
sizeLabel = 'size: S';
} else if (totalChanges < 200) {
sizeLabel = 'size: M';
} else if (totalChanges < 500) {
sizeLabel = 'size: L';
} else if (totalChanges < 1000) {
sizeLabel = 'size: XL';
} else {
sizeLabel = 'size: XXL';
}
// Remove old size labels
const currentLabels = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number
});
const sizeLabels = currentLabels.data
.map(label => label.name)
.filter(name => name.startsWith('size: '));
for (const label of sizeLabels) {
if (label !== sizeLabel) {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
name: label
});
}
}
// Add new size label
if (!sizeLabels.includes(sizeLabel)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: [sizeLabel]
});
}
// Log the changes
console.log(`PR #${pr.number}: +${additions} -${deletions} = ${totalChanges} changes → ${sizeLabel}`);