Commit Graph

47 Commits

Author SHA1 Message Date
MaksimZhukov
917e5cce72 Merge branch 'main' 2023-10-24 12:11:31 +02:00
Eric Cornelissen
b3ae1bded7 Make jest-each a devDependency (#611)
* Make `jest-each` a devDependency

Change the dependency on `jest-each` from a regular dependency to a
development dependency (devDependency) as it is only used in tests.

* Remove `jest-each` and use `test-each` instead
2023-07-11 14:57:50 +02:00
Nathan Hammond
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 Stanley
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 Ridgwell
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
Daniel Shteremberg
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 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
Alexander Kachkaev
71d2484daa Address review comment 2023-05-31 18:46:23 +01:00
Alexander Kachkaev
e3b3815c8d Further diff reduction 2023-05-31 01:54:22 +01:00
Alexander Kachkaev
44414dbc7d Fix tests 2023-05-31 01:50:00 +01:00
Alexander Kachkaev
60f44e7cf1 Fix unrelated test 2023-05-31 01:45:27 +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
3352df1f2b Bring test I accidently deleted 2023-05-17 07:26:44 -04:00
Josh Dales
57d34076e0 Better check for empty configs in checkAll 2023-05-17 07:05:19 -04: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
8e6367ddee Merge branch 'main' into main 2023-03-23 09:02:46 -04:00
Adam Azarchs
751921c443 fix: correct reading of sync-labels input. (#480)
* fix: correct reading of sync-labels input.

Contrary to the assumptions made in the unit tests, core.getInput
always returns a string, and !!'false' is true.

Also updates the unit test to reduce changes of regressions by ensuring
that the mocked getInput returns a string, as it would in production.

Fixes https://github.com/actions/labeler/issues/112

Make sure test catches regressions.

* Rebuild dist/index.js.
2023-03-23 10:47:14 +01:00
Josh Dales
b25e3a8c27 Better wording for the new test 2023-03-20 17:51:58 -04:00
Josh Dales
d31255f7be Make sure that empty config options don't accidently label things 2023-03-20 17:40:28 -04:00
Josh Dales
e9a1777eb0 Fix linting and formatting 2023-03-18 16:46:54 -04:00
Josh Dales
90ef37079a Merge branch 'actions:main' into main 2023-03-18 16:44:40 -04:00
Ivan
8d81f881dd Add and configure ESLint and update configuration for Prettier (#508)
* Add ESLint and update Prettier

* Rebuild action

* Update package.json
2023-03-09 15:02:17 +02:00
Josh Dales
09f085373a Fix some typos in the branch checks 2023-02-19 12:17:15 -05:00
Alexander Kachkaev
866eff55a5 Merge remote-tracking branch 'origin/main' into dot-option 2023-01-16 17:36:24 +00:00
Josh Dales
c54c5a2057 Run prettier 2023-01-11 17:09:44 -05:00
Josh Dales
7f8d8e472d Merge branch 'main' into main 2023-01-11 17:02:22 -05:00
IvanZosimov
0cad484cd0 Add .prettierrc.json to configure Prettier, reformat code 2022-12-19 17:09:22 +01:00
Alexander Kachkaev
b0d9292064 Implement dot option 2022-02-04 13:26:54 +00:00
Josh Dales
7aadc17f94 Update the tests for applying multiple branch based labels 2021-10-28 22:33:25 -04:00
Josh Dales
ab49f7a2bd Add tests for array branh labelling 2021-09-29 10:32:05 -04:00
Amiel Martin
79c0cc7c0b Include a test for branching 2021-09-15 10:14:24 -08:00
Amiel Martin
d9ed3e87f6 Format 2021-09-15 09:58:18 -08:00
Amiel Martin
cb5f4480b2 Use correct branch name and update tests 2021-09-15 09:23:41 -08:00
Josh Dales
bce88a9ea3 Update new test description 2021-08-07 15:26:13 -04:00
Josh Dales
a01b9aebb2 Add another test to make sure that partial branch naming works 2021-08-07 15:20:20 -04:00
Josh Dales
ee0e0eb513 Add a new fixture and test for the branch checking 2021-08-07 15:12:02 -04:00
dependabot[bot]
9b2da75f4b Bump @actions/github from 2.2.0 to 5.0.0 (#161)
* Bump @actions/github from 2.2.0 to 5.0.0

Bumps [@actions/github](https://github.com/actions/toolkit/tree/HEAD/packages/github) from 2.2.0 to 5.0.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/github/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/github)

---
updated-dependencies:
- dependency-name: "@actions/github"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* update licensed cache

* Code changes to support github 5.0

* regenerate dist/index

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Patrick Ellis <patrick.j.ellis@gmail.com>
2021-06-21 11:39:52 -04:00
Patrick Ellis
c97a9580dd Update prettier to 2.3.0 and re-prettify everything
Gotta love those trailing commas!
2021-06-04 16:14:32 -04:00
Patrick Ellis
a1aa618e7a Fix recursive glob behavior in our npm format script command 2021-06-04 15:55:26 -04:00
Patrick Ellis
c9d0dfc82e 🧹 Add tests that run the whole action (#149) 2021-06-04 14:46:22 -04:00
Patrick Ellis
9019323db1 🧹 Add basic unit tests (#148)
This is not intended to be a comprehensive test suite; I'm just trying to get us started by adding tests for some of the most important functionality.

This necessitated some minor refactoring. Previously, `main.ts` just directly invoked the main entrypoint function `run()`, which made it impossible to unit test the module without causing the side-effects of `run`. 

As a workaround I created  a new module `labeler.ts`, which just exports the functions we want to test without executing the main entrypoint, and simplified `main.ts` so that it only imports the entrypoint and executes it.

It's basically just a re-org. The diff makes it look way more complicated than it is.
2021-06-03 16:15:47 -04:00
David Kale
fa244eaba5 Paginate and remove old labels (#96)
* Paginate to get all changed files. Add option to remove labels

* build

* format and build
2020-09-08 13:09:16 -04:00
Shawn Napora
7d083c498f Update to labeler v2 (#4)
* labeler v2

* update docs
2019-08-08 13:07:40 -04:00