Skip to content

Update PR template

Update PR template #3

Workflow file for this run

name: "Pull Request Labeler"
on:
pull_request_target:
jobs:
labeler:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/labeler@v5
with:
configuration-path: .github/labeler.yml
- name: Calculate the PR size
uses: actions/github-script@v7
id: calculate-size
with:
script: |
const diff = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
mediaType: {
format: "diff",
},
});
const changedLines = diff.data
.split("\n")
.filter(line => line.startsWith('+') || line.startsWith('-'))
.length;
let label = '';
if (changedLines > 1000) label = 'size:XXL';
else if (changedLines > 499) label = 'size:XL';
else if (changedLines > 99) label = 'size:L';
else if (changedLines > 29) label = 'size:M';
else if (changedLines > 9) label = 'size:S';
else label = 'size:XS';
core.setOutput("size-label", label);
- name: Apply size label
uses: actions/github-script@v7
with:
script: |
const label = core.getInput('size-label');
if (label) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [label]
});
}