Skip to content

chore: restructure pages to home #10

chore: restructure pages to home

chore: restructure pages to home #10

name: size-label
on:
pull_request:
types: [opened, synchronize]
jobs:
size-label:
permissions:
contents: read
pull-requests: write
issues: write
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout repository
uses: actions/checkout@v4
- name: Determine PR size and add label
id: size-label
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORED: |
yarn.lock
package-lock.json
pnpm-lock.yaml
package.json
.pnp.*
dist/
build/
.cache/
LICENSE
with:
sizes: >
{
"0": "XS",
"50": "S",
"150": "M",
"500": "L",
"1000": "XL",
"3000": "XXL"
}
- name: Set label colors
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const labelsToColor = {
'XS': 'd4c5f9', // Light purple
'S': 'c2e0c6', // Light green
'M': 'f9d0c4', // Light red
'L': 'f7c6c7', // Light pink
'XL': 'fef2c0', // Light yellow
'XXL': 'e99695', // Light coral
};
const sizeLabel = ${{ steps.size-label.outputs.sizeLabel }};
const color = labelsToColor[sizeLabel] || 'b0b0b0';
if (sizeLabel) {
try {
await github.rest.issues.updateLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: sizeLabel,
color: color,
});
} catch (error) {
// Label doesn't exist, create it
await github.rest.issues.createLabel({
owner: context.repo.owner,
repo: context.repo.repo,
name: sizeLabel,
color: color,
});
}
}
- name: Comment on large PRs
if: ${{ contains('XL XXL', steps.size-label.outputs.sizeLabel) }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "This PR is too large and may need to be broken into smaller pieces."
});