Skip to content

feat(github.pr.size-labeler): add runtime-installed GitHub Script action - #47

Merged
posquit0 merged 8 commits into
mainfrom
feat/github-pr-size-labeler
Oct 24, 2026
Merged

posquit0 merged 8 commits into
mainfrom
feat/github-pr-size-labeler

Conversation

@posquit0

@posquit0 posquit0 commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

👋 Background

The existing PR size labeler downloads an x86_64-only helper and fails on ARM runners. Replace it with a composite action that preserves tedilabs' size/deletion policies without committing build artifacts.

⚙️ Description

  • Add .github/actions/github.pr.size-labeler using actions/github-script@v9 and plain JavaScript. Set up Node 24 and install locked npm dependencies in a fresh runner-temporary directory with lifecycle scripts disabled. The package is named github-pr-size-labeler; no transpilation or bundled dist is needed.
  • Use github_token, matching other tedilabs composite actions. Preserve every pre-existing input description in github.pr.auto-label.yaml and keep its thresholds at 15/100/500/1000 with the existing exclusive-boundary behavior.
  • Discover .github/size-labeler.yaml, then .github/size-labeler.yml, or read config_file. Read from the PR base SHA. YAML groups size settings under sizes.<xs|s|m|l|xl>.label/max_size (XL has no max_size). Partial settings override matching flat action inputs field by field; old flat size keys in config files are rejected. Credentials, API URL, PR number, and config path remain invocation inputs.
  • Use overwrite_size_labels (default true) for the five configured XS/S/M/L/XL names. When true, replace existing configured labels, including manually applied ones, with the calculated label. When false, preserve all existing labels if any configured size label exists; otherwise add the first size label. Other label names, including other size/* labels, are always preserved. The workflow exposes pr_size_overwrite_size_labels.
  • Support ignored-path globs, independent deletion filters, sticky XL comments, optional XL failure, dry runs, and outputs. Paginate API reads and reject ambiguous truncated counts before writes.

Validation: 107 local tests passed, including 73 policy scenarios and focused configuration/API tests. Nested config tests cover partial overrides, fixed size order, invalid mappings/fields, XL bounds, and rejection of flat file keys. Existing workflow descriptions were compared against main and match exactly. YAML lint, GitHub action/workflow schemas, jactionlint, and diff checks passed. Dedicated Linux AMD64 and ARM64 CI tests the actual composite with runtime npm installation and read-only GitHub API calls.


🚨 To Reviewers

  • feat(github.pr.size-labeler): add Python uv alternative #48 was closed in favor of this GitHub Script implementation: it reuses the provided GitHub client, workflow context, outputs, and failure reporting with less integration code.
  • Label handling is by configured name, not by actor. Disabling overwrite preserves both manually applied labels and labels from previous action runs. The default remains true so automatic labeling continues to update after pushes.
  • Outputs and XL comment/failure policy follow the calculated size even when existing labels are preserved. added_labels and removed_labels are empty when no label change is planned.
  • File config also overrides dry_run. Use a read-only token and ensure the base config does not disable dry-run mode for trial runs.
  • Live mutations are covered by mocked API tests; remote smoke tests are read-only. The existing pull_request_target workflow continues using main until merge.

@github-actions github-actions Bot added 💾 actions This issue or pull request is related to actions. 💾 workflows This issue or pull request is related to workflows. labels Oct 24, 2026
@github-actions github-actions Bot added the size/XL Extra Large size issue or PR. label Oct 24, 2026
@github-actions

Copy link
Copy Markdown

This PR has too many changes. Please make sure you are NOT addressing multiple issues with one PR.

@github-actions

Copy link
Copy Markdown

GitHub Actions Integration

Repository jactionlint check-jsonschema (workflows) check-jsonschema (actions)
tedilabs/github-actions ✅ ✅ ✅

✅ All 1 passed.

@posquit0 posquit0 changed the title feat(github.pr.size-labeler): add configurable native PR size labeling feat(github.pr.size-labeler): add runtime-installed GitHub Script action Oct 24, 2026
@posquit0
posquit0 merged commit 842f33e into main Oct 24, 2026
9 checks passed
@posquit0
posquit0 deleted the feat/github-pr-size-labeler branch October 24, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💾 actions This issue or pull request is related to actions. 💾 workflows This issue or pull request is related to workflows. size/XL Extra Large size issue or PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant