Commit Graph
115 Commits
Author SHA1 Message Date
Logan RosenandCopilot App b7a8804475 Preserve externally managed labels during synchronization (#957)
* Preserve externally managed pull request labels

Replace whole-set label writes with batched selective additions and removals so sync-labels only manages configured labels.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44452010-1cd5-4e90-8abe-f03547c04182

* Reconcile ambiguous label addition failures

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44452010-1cd5-4e90-8abe-f03547c04182

* Handle paginated label reconciliation

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 44452010-1cd5-4e90-8abe-f03547c04182

---------

Copilot-Session: 44452010-1cd5-4e90-8abe-f03547c04182
2026-07-30 21:51:30 -05:00
Chiranjib Swain bf12e9b00b feat: migrate to ESM and update dependencies (#949)
* feat: migrate to ESM and update dependencies

- Migrated the project to ESM to support the latest `@actions/*` package versions.
- Updated dependencies to their latest versions, including `@actions/core`, `@actions/github`, and others.
- Replaced `.prettierrc.js` with `.prettierrc.json` for configuration.
- Updated ESLint configuration to use ESM and added new rules.
- Refactored test files to use `jest` with ESM imports.
- Removed deprecated files and updated import paths to use `.js` extensions.
- Added new files for improved configuration and removed unnecessary mocks.
- Updated README to reflect breaking changes in version 7.

* docs: update README to clarify ESM migration details and adjust TypeScript configuration
2026-07-16 11:04:03 -05:00
Chiranjib Swain f612d9ad18 Fix: Improve PR number validation and warning messages in input handling (#939)
* Fix: Improve PR number validation and warning messages in input handling

* Fix: Enhance PR number validation with improved sanitization and warning messages

* Fix: Change sanitizeForWarning to a local function for better encapsulation
2026-06-22 16:16:37 -05:00
Copilotandchiranjib-swain f27b608878 chore: upgrade dependencies (@actions/core, @actions/github, js-yaml, minimatch, @typescript-eslint) (#934)
* chore: upgrade dependencies and update license cache

Agent-Logs-Url: https://github.com/actions/labeler/sessions/b9db86f9-e9cd-4c8a-a1a1-84e33ef84437

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

* fix: remove unused error variable in catch block to fix lint

Agent-Logs-Url: https://github.com/actions/labeler/sessions/7a6c6978-c912-4278-be03-f22f98e28f71

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

* build: update dist/index.js with latest source changes

Agent-Logs-Url: https://github.com/actions/labeler/sessions/a5e02d2e-473f-4106-9227-2b5b25b15b81

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

* chore: bump version to 6.1.0, update lockfile, and rebuild dist/index.js

Agent-Logs-Url: https://github.com/actions/labeler/sessions/08c6ea0c-fa19-47d8-a4fd-bbdaf444071f

Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: chiranjib-swain <196914770+chiranjib-swain@users.noreply.github.com>
2026-05-05 21:37:09 -05:00
Luca Boccassi c5dadc2a45 Add 'changed-files-labels-limit' and 'max-files-changed' configs to allow capping number of labels added (#923)
* README.md: drop trailing whitespace

* Add 'changed-files-labels-limit' config to allow capping number of labels added

When a repository has many components, each with a changed-files label,
a large refactor ends up with the labeler spamming the pull request
with label changes. The end result is not very useful as it's not
very readable, and due to how github automatically hides comments
when label changes overflow the discussion tab, it means useful
information is hidden and one has to manually click "Load more..."
dozens of time every time the page is loaded.

Add a changed-files-labels-limit top level config knob. If more than the
configured limit of labels is set to be added, none are added.
This only affects changed-files labels.

* Add 'max-files-changed' config to allow capping number of files for labelling

When a PR modifies a very large number of files (e.g., tree-wide
refactors, automated code formatting), this new options allows
skipping file-based labeling entirely when the number of files
that are changed hits the configured limit.

Fixes https://github.com/actions/labeler/issues/486
2026-03-26 10:03:12 -05:00
Chiranjib Swain 77a4082b84 Fix: Preserve manually added labels during workflow run and refine label sync logic (#917)
* Refactor labeler function to improve label management and deduplication logic

* Refactor labeler function to improve label handling and ensure manual labels are prioritized
2026-01-22 13:13:24 -06:00
Chiranjib Swain 25abb3cad4 Improve Labeler Action Documentation and Error Handling for Permissions (#897)
* Update README.md and labeler.ts to clarify permissions for GitHub Labeler Action

* Update dist/index.js with latest build changes

* Update README.md to clarify manual label creation as an alternative to granting issues write permission

* Fix labeler error handling to ensure case-insensitive check for unauthorized access

* Refactor error handling in labeler to throw an error for unauthorized access instead of logging

* Add tests for labeler error handling and improve error reporting
2025-09-19 14:46:04 -05:00
HarithaVattikuti 3629d5568b Document update - permission section (#840)
* Update Section

* Update warning
2025-01-16 08:46:55 -06:00
MaksimZhukov 9181355e36 Apply suggestions for the beta vesrion and update the documentation 2023-10-31 13:09:20 +01:00
MaksimZhukov 917e5cce72 Merge branch 'main' 2023-10-24 12:11:31 +02:00
Nikolai Laevskii df65a7144a Use lodash's isEqual 2023-10-04 11:23:34 +02:00
Nikolai Laevskii 27ee87f076 Update naming 2023-09-25 15:28:47 +02:00
MaksimZhukov f4eefdc659 [Beta] Implement the new structure of the match object for the changed-files section (#680)
* Implement the new structure of the match object for changed files section

* Replace inner loops with the find method
2023-09-20 13:43:39 +02:00
Nikolai Laevskii bebba55950 Merge branch 'main' into v4-general-refactoring 2023-08-02 06:25:30 +02:00
Nikolai Laevskii 3b7f505149 General refactoring 2023-08-02 06:13:14 +02:00
TrianguloY 5bb656d641 Fix double negation message typo (#629)
* Fix double negation typo

* Rebuild index.js
2023-07-31 14:42:10 +02:00
be13bbd1b7 Early exit when no files are changed. (#456)
* Early exit when no files are changed.

As a consequence of the `checkAll` function call returning `true` if the length of `changedFiles` is 0, this must early-exit in order to avoid labeling empty PRs.

* Update dist.

* Update for new code styles.

* review changes requested

* Update dist.

* chore: prettify code

---------

Co-authored-by: MaksimZhukov <maksimzhukov@github.com>
Co-authored-by: IvanZosimov <ivanzosimov@github.com>
2023-07-07 16:35:16 +02:00
Liam StanleyandIvanZosimov 994304c5d5 feat(config): support reading from local file if it exists (#394)
* feat(config): support reading from local file if it exists

Signed-off-by: Liam Stanley <me@liamstanley.io>

* fix: fix review point, update logic

* docs: update readme

* docs: update readme

* feat: add additional logging

* chore: update licenses

* docs: fix review point in readme.md

---------

Signed-off-by: Liam Stanley <me@liamstanley.io>
Co-authored-by: IvanZosimov <ivanzosimov@github.com>
2023-07-07 12:44:54 +02:00
Mark RidgwellandMaksimZhukov 327d35fdca Added ability to pass in an optional PR number as a parameter (#349)
* Adding pr-number as an optional parameter

* Updated README

* Tests on the pr-number parameter

* Added missing | to table

* re-built script

* Adding support for multiple pr-numbers

* excluded .idea

* Updated readme to reflect that there might be more than one PR

* Additional warning

* Removed unused

* Reformatted and re-built

* Corrected message

* Removed required check

* Added (s) to pull request numbers in the description

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>

* Reworded PR-number parameter description

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>

* adding getMultilineInput into the tests

* Fixing tests for single pr

* Fixing tests for multiple prs

* Updated README.md to make it more obvious that it can take a list of PRs

* Added example that labels PR's 1-3

* Handled no pull requests better (from code review)

* Handled no pull requests better (from code review)

* Handled missing pull request better (from code review)

* Back out suggested change as it broke the tests

* Rebuilt dist

* Update src/labeler.ts

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>

* Added Emphasis to the note

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>

* Changed mockInput for pr-number to be string[]

---------

Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
2023-07-06 17:10:50 +02:00
Lukas HenniesandAndreiLobanovich e3c0d9b6cc Improved Error message for missing config file (#475)
* error message for missing config

* chore: formatting and index js

* chore: update json5

* changes from cr

Co-authored-by: AndreiLobanovich <andreilobanovich@github.com>

* chore: recreate dist.js

* chore: revert package-lock

* chore: newline fix

---------

Co-authored-by: AndreiLobanovich <andreilobanovich@github.com>
2023-06-30 12:09:04 +02:00
0967ca812e Added output (#60)
* Added output

* removed formatting changes

* more formatting changes

* Fix merge conflicts

* Small test refactoring

* tests are passing

* Add a test

* Add a small jest mock for addLabels. Not used.

* Add tests for more cases

* get rid of an unused jest mock

* fix review points

* rebuild + minor README fix

* fix review points

* update tests

* fix formatting

* add tests, fix bug

* cleanup

---------

Co-authored-by: Daniel Shteremberg <dshteremberg@labelbox.com>
Co-authored-by: Daniel Shteremberg <Daniel@Daniel-Shterembergs-MacBook-Pro.local>
Co-authored-by: Patrick Ellis <patrick.j.ellis@gmail.com>
Co-authored-by: Andrey Lobanovich <andrei.lobanovich@akvelon.com>
2023-06-29 12:45:24 +02:00
Mark MassoudandMark Massoud 7a202e6428 fix: Limit number of labels added to 100 (#497)
* push to excess labels to avoid reaching the limit

* build dist

* never set more than 100 labels

* use splice instead of set

* ignore IDE folders

* install @octokit/plugin-retry

* always setLabels

* fix indentations

* fix specs

* add spec for excess labels

* prettier

* licensed cache

* revert to !!core.getInput('sync-labels')

* better warning for exceeded labels

* keep manually-added labels

* nest the dedupe logic

* rename `removeLabel` to `removeLabelFromList` to avoid confusion

* use Sets, and issue a call only if labels have actually changed

* remove IDE config folders from gitignore

* remove obsolete duplucation check

---------

Co-authored-by: Mark Massoud <mark@unrealcloud.io>
2023-06-21 11:49:43 +02:00
Josh Soref b5ff161cf0 Explain misconfigured workflow (#405)
Fixes #136
2023-06-19 13:07:00 +02:00
Alexander Kachkaev 71d2484daa Address review comment 2023-05-31 18:46:23 +01:00
Alexander Kachkaev 54d434dac5 Remove required: false 2023-05-31 17:23:26 +01:00
Alexander Kachkaev e3b3815c8d Further diff reduction 2023-05-31 01:54:22 +01:00
Alexander Kachkaev a27020c135 Undo unwanted change in diff 2023-05-31 01:49:55 +01:00
Alexander KachkaevandAndreiLobanovich 092c979868 Update src/labeler.ts
Co-authored-by: AndreiLobanovich <andreilobanovich@github.com>
2023-05-31 01:44:56 +01:00
Alexander Kachkaev cecbd94bd4 Merge remote-tracking branch 'u/main' into dot-option 2023-05-31 01:35:46 +01:00
MaksimZhukov 26342ba349 fix: correct reading of sync-labels input 2023-05-24 12:21:33 +02:00
MaksimZhukov e1fcf6fe5b Merge pull request #203 from joshdales/main
Assigns labels based on branch names
2023-05-24 12:01:55 +02:00
MaksimZhukov 5c4deb8a24 Revert "fix: correct reading of sync-labels input. (#480)" (#564)
This reverts commit 751921c443.
2023-05-23 19:06:03 +02:00
Josh Dales 57d34076e0 Better check for empty configs in checkAll 2023-05-17 07:05:19 -04:00
Josh Dales a256a58edf Add check for empty objects in checkAll 2023-05-15 10:45:56 -04:00
Josh Dales 4ac17648a4 Add a guard clause to stop false changed-files positives 2023-05-11 17:02:05 -04:00
Josh Dales 34a5bf6e83 Update the validation when there are no options in the matchConfigs 2023-05-11 17:01:46 -04:00
Josh Dales 09645fd40d Move the allowed Matchconfig keys into a constant 2023-05-11 16:37:58 -04:00
Josh DalesandMaksimZhukov 51cc5e079c Update text in test descriptions and logging
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
2023-05-11 16:35:05 -04:00
Josh Dales 11812c37f6 Revert "Have a single isMatch for checking changed files"
This reverts commit d4d4a104a2.
2023-05-05 08:56:09 -04:00
Josh Dales d4d4a104a2 Have a single isMatch for checking changed files 2023-04-13 14:38:41 -04:00
Josh Dales 2f1dfd1ef0 Adjust the indenting again 2023-03-27 17:15:14 -04:00
Josh Dales b1a2f85ed8 Update debugging indentation on the branch checks 2023-03-27 16:37:55 -04:00
Josh Dales 67604ee822 Update more debugging statements 2023-03-27 16:26:58 -04:00
Josh Dales 3ddce51a65 Update the debug values 2023-03-27 16:15:03 -04:00
Alexander Kachkaev a7cc8a62ef Fix 2023-03-27 09:47:52 +01:00
Alexander Kachkaev b28379f6ed Cleanup 2023-03-27 09:44:05 +01:00
Alexander Kachkaev b898cc8e29 Merge remote-tracking branch 'u/main' into dot-option 2023-03-27 09:39:25 +01:00
Josh Dales fa7f98c785 Yikes, still missed that 2023-03-25 19:09:06 -04:00
Josh Dales 0b2cfb01d7 Im an idiot, bad copy pasta 2023-03-25 17:42:17 -04:00
Josh Dales ef6ab1b64a Add function for checking if any path matches 2023-03-25 17:22:04 -04:00