Skip to content

Commit 790020c

Browse files
authored
chore: update node from 12+ to 20+ (#192)
1 parent fb5f420 commit 790020c

File tree

1 file changed

+80
-101
lines changed

1 file changed

+80
-101
lines changed

README.md

Lines changed: 80 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,22 @@
1-
21
# GitHub Label Sync [![NPM version](https://img.shields.io/npm/v/github-label-sync.svg)](https://www.npmjs.com/package/github-label-sync) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)][license]
32

43
Synchronise your GitHub labels with as few destructive operations as possible – similar labels get renamed.
54

6-
Table Of Contents
7-
-----------------
8-
9-
- [Requirements](#requirements)
10-
- [Command-Line Interface](#command-line-interface)
11-
- [JavaScript Interface](#javascript-interface)
12-
- [Label Config File](#label-config-file)
13-
- [Configuration](#configuration)
14-
- [Contributing](#contributing)
15-
- [License](#license)
16-
5+
## Table Of Contents
176

18-
Requirements
19-
------------
7+
- [Requirements](#requirements)
8+
- [Command-Line Interface](#command-line-interface)
9+
- [JavaScript Interface](#javascript-interface)
10+
- [Label Config File](#label-config-file)
11+
- [Configuration](#configuration)
12+
- [Contributing](#contributing)
13+
- [License](#license)
2014

21-
You'll need [Node.js][node] 12+ installed to run GitHub Label Sync. You'll also need a GitHub access token ready so that the tool will have access to your repositories. You can [generate an access token here][access-tokens], be sure to allow the "repo" scope.
15+
## Requirements
2216

17+
You'll need [Node.js][node] 20+ installed to run GitHub Label Sync. You'll also need a GitHub access token ready so that the tool will have access to your repositories. You can [generate an access token here][access-tokens], be sure to allow the "repo" scope.
2318

24-
Command-Line Interface
25-
----------------------
19+
## Command-Line Interface
2620

2721
Install GitHub Label Sync globally with [npm][npm]:
2822

@@ -75,9 +69,7 @@ Normally any additional labels found on the repo are deleted. Run GitHub label s
7569
github-label-sync --access-token xxxxxx --allow-added-labels myname/myrepo
7670
```
7771

78-
79-
JavaScript Interface
80-
--------------------
72+
## JavaScript Interface
8173

8274
Install GitHub Label Sync with [npm][npm] or add to your `package.json`:
8375

@@ -97,13 +89,13 @@ Run GitHub Label Sync on a repo ([passing in options](#configuration)):
9789

9890
```js
9991
githubLabelSync({
100-
accessToken: 'xxxxxx',
101-
repo: 'myname/myrepo',
102-
labels: [
103-
// label config
104-
]
92+
accessToken: 'xxxxxx',
93+
repo: 'myname/myrepo',
94+
labels: [
95+
// label config
96+
]
10597
}).then((diff) => {
106-
console.log(diff);
98+
console.log(diff);
10799
});
108100
```
109101

@@ -113,108 +105,101 @@ When the promise resolves successfully, its value will be set to a diff between
113105

114106
```js
115107
[
116-
// This is a "missing" diff, it indicates that a label
117-
// present in your local config is not present on GitHub.
118-
{
119-
name: 'local-label-name',
120-
type: 'missing',
121-
actual: null,
122-
expected: {
123-
name: 'local-label-name',
124-
color: 'ff0000'
125-
}
126-
},
127-
// This is a "changed" diff, it indicates that a label
128-
// present on GitHub has diverged from your local config.
129-
// This could mean that either somebody has modified the
130-
// label manually on GitHub, or the local config has
131-
// been updated.
132-
{
133-
name: 'local-label-name',
134-
type: 'changed',
135-
actual: {
136-
name: 'remote-label-name',
137-
color: '00ff00'
138-
},
139-
expected: {
140-
name: 'local-label-name',
141-
color: 'ff0000'
142-
}
143-
},
144-
// This is an "added" diff, it indicates that a label
145-
// is present on GitHub but not in your local config.
146-
{
147-
name: 'remote-label-name',
148-
type: 'added',
149-
actual: {
150-
name: 'remote-label-name',
151-
color: 'ff0000'
152-
},
153-
expected: null
154-
}
155-
]
108+
// This is a "missing" diff, it indicates that a label
109+
// present in your local config is not present on GitHub.
110+
{
111+
name: 'local-label-name',
112+
type: 'missing',
113+
actual: null,
114+
expected: {
115+
name: 'local-label-name',
116+
color: 'ff0000'
117+
}
118+
},
119+
// This is a "changed" diff, it indicates that a label
120+
// present on GitHub has diverged from your local config.
121+
// This could mean that either somebody has modified the
122+
// label manually on GitHub, or the local config has
123+
// been updated.
124+
{
125+
name: 'local-label-name',
126+
type: 'changed',
127+
actual: {
128+
name: 'remote-label-name',
129+
color: '00ff00'
130+
},
131+
expected: {
132+
name: 'local-label-name',
133+
color: 'ff0000'
134+
}
135+
},
136+
// This is an "added" diff, it indicates that a label
137+
// is present on GitHub but not in your local config.
138+
{
139+
name: 'remote-label-name',
140+
type: 'added',
141+
actual: {
142+
name: 'remote-label-name',
143+
color: 'ff0000'
144+
},
145+
expected: null
146+
}
147+
];
156148
```
157149

158-
159-
Label Config File
160-
----------
150+
## Label Config File
161151

162152
The labels to sync with are defined as an array in either JavaScript, JSON or YAML. The array must contain only label objects, which look like this:
163153

164154
As JSON:
165155

166156
```json
167157
{
168-
"name": "mylabel",
169-
"color": "ff0000",
170-
"aliases": [],
171-
"description": "optional description",
172-
"delete": false
158+
"name": "mylabel",
159+
"color": "ff0000",
160+
"aliases": [],
161+
"description": "optional description",
162+
"delete": false
173163
}
174164
```
175165

176166
As YAML:
177167

178168
```yaml
179169
- name: mylabel
180-
color: "ff0000"
170+
color: 'ff0000'
181171
aliases: []
182172
description: optional description
183173
delete: false
184174
```
185175
186-
- The `name` property refers to the label name.
187-
- The `color` property should be a hex code, with or without the leading `#`.
188-
- The `delete` property is optional. When set to `true`, matches for this label will _always_ be deleted. This can be used in conjunction with [allowAddedLabels](#allowaddedlabels) to flag specific labels for deletion while leaving non-specified labels intact. Defaults to `false`.
176+
- The `name` property refers to the label name.
177+
- The `color` property should be a hex code, with or without the leading `#`.
178+
- The `delete` property is optional. When set to `true`, matches for this label will _always_ be deleted. This can be used in conjunction with [allowAddedLabels](#allowaddedlabels) to flag specific labels for deletion while leaving non-specified labels intact. Defaults to `false`.
189179

190180
The `aliases` property is optional. When GitHub Label Sync is determining whether to update or delete/create a label it will use the aliases property to prevent used labels from being deleted.
191181

192182
For example, given the following config, GitHub Label Sync will look for labels on GitHub named either "feature" or "enhancement" then _update_ them to match the newer config rather than deleting them.
193183

194184
```json
195185
{
196-
"name": "type: feature",
197-
"color": "00ff00",
198-
"aliases": [
199-
"enhancement",
200-
"feature"
201-
]
186+
"name": "type: feature",
187+
"color": "00ff00",
188+
"aliases": ["enhancement", "feature"]
202189
}
203190
```
204191

205192
You can find a full example label configuration in this repository ([JSON](labels.json) / [YAML](labels.yml)).
206193

207-
208-
Configuration
209-
-------------
194+
## Configuration
210195

211196
### `accessToken`
212197

213198
_String_. The [GitHub access token][access-tokens] to use when fetching/updating labels. This must be an access token that has permission to write to the repository you want to sync labels with.
214199

215200
```js
216201
githubLabelSync({
217-
accessToken: 'xxxxxx'
202+
accessToken: 'xxxxxx'
218203
});
219204
```
220205

@@ -231,7 +216,7 @@ _Boolean_. Whether to allow labels on GitHub which are not specified in your [la
231216

232217
```js
233218
githubLabelSync({
234-
allowAddedLabels: true
219+
allowAddedLabels: true
235220
});
236221
```
237222

@@ -247,7 +232,7 @@ _Boolean_. Whether to perform a dry run, only making safe "read" requests to the
247232

248233
```js
249234
githubLabelSync({
250-
dryRun: true
235+
dryRun: true
251236
});
252237
```
253238

@@ -263,7 +248,7 @@ _Array_. Your label configuration. See the section on [label config file](#label
263248

264249
```js
265250
githubLabelSync({
266-
labels: []
251+
labels: []
267252
});
268253
```
269254

@@ -275,7 +260,7 @@ _String_. The GitHub repo to sync labels to. This should include the user and re
275260

276261
```js
277262
githubLabelSync({
278-
repo: 'Financial-Times/ft-origami'
263+
repo: 'Financial-Times/ft-origami'
279264
});
280265
```
281266

@@ -285,9 +270,7 @@ The command-line accepts the repo as an argument after the options:
285270
github-label-sync Financial-Times/ft-origami
286271
```
287272

288-
289-
Contributing
290-
------------
273+
## Contributing
291274

292275
To contribute to GitHub Label Sync, clone this repo locally and commit your code on a separate branch.
293276

@@ -300,15 +283,11 @@ npm run test-unit # run the unit tests
300283
npm run test-coverage # run the unit tests with coverage reporting
301284
```
302285

303-
304-
License
305-
-------
286+
## License
306287

307288
This software is published by the Financial Times under the [MIT licence][license].
308289

309-
310-
311290
[access-tokens]: https://github.com/settings/tokens
312291
[license]: http://opensource.org/licenses/MIT
313292
[node]: https://nodejs.org/
314-
[npm]: https://www.npmjs.com/
293+
[npm]: https://www.npmjs.com/

0 commit comments

Comments
 (0)