Octokit: Cannot create multible Labels

Cannot create multible Labels (REST API)

Code Sample:

	srcRepoReq.data.map(async (label) => {
		const newLabel: ghLabel = {
			name: label.name,
			color: label.color,
			description: label.description,
		const createLabelReq = await octokit.request('POST /repos/{username}/{trgtRepo}/labels', {
			username: cfg.username,
			trgtRepo: cfg.trgtRepo,
			name: newLabel.name,
			color: newLabel.color,
			description: newLabel.description,

What i want to do:

I want to create multible Labels using GitHub’s @octokit/core API Client.


All those promises don’t seem to be executed. I won’t get any Text from those two Terminal.* Methods.
Also no Label is showing up at the Repo. But if i execute the Code outside of Promise.all(srcRepoReq.data.map(...)); it works perfectly fine and the Labels are getting created. But i have to exec every Request manually and hardcode them into the code. Which is not what i want to do. I want to create Labels based on an Array of Elements.

type ghLabel  = {
	name: string;
	color: string;
	description: string;

This contains all Data that is required by the GitHub API REST to create a label.

Could this be 'cause of some restriction on the GitHub-Side ? Only <number> of requests per <time> ?

To Clarify

yes. the types are correct. I already verified that.

Any Solutions ?

(GraphQL API Solutions also possible)

1 Like

i found a solution/workaround myself. You can see a working example here: gh-label-copy/ghlc.ts at e1b5cd818b84a6a01642f0f1df2217ee82a7bbd5 · OliverKarger/gh-label-copy · GitHub