1.1.10 • Published 10 months ago

@culur/changesets-github-info v1.1.10

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@culur/changesets-github-info

NPM Version NPM Download NPM License

CodeFactor Codecov Build and release

Get the GitHub username and PR number from a commit. Intended for use with changesets.

✨ Features

This library if a fork of @changesets/get-github-info. The main purpose of this library is to customize the returned results to suit the needs of use in @culur/changesets-changelog-github.

It uses @octokit/graphql and dataloader to query data. It also takes advantage of the dataloader's caching and batching features to optimize queries.

💿 Installation

Add @culur/changesets-github-info dependency to your project.

# Using npm
npm install @culur/changesets-github-info

# Using pnpm
pnpm install @culur/changesets-github-info

# Using yarn
yarn add @culur/changesets-github-info

📖 Usage

You need a GitHub Personal Access Token with read:user and repo:status permissions, and add it to a .env file.

GITHUB_TOKEN=token

Then you can use it in your script like this.

import {
  getCommitInfo,
  getPullRequestInfo,
} from '@culur/changesets-github-info';
import { config } from 'dotenv';

config();

const commitInfo = await getCommitInfo({
  repo: 'culur/culur',
  commitHash: '65810fdd21ad34a2b06e42e977480bbfade20375',
});

const pullRequestInfo = await getPullRequestInfo({
  repo: 'culur/culur',
  pullRequestNumber: 3,
});

const commitInfo = {
  user: {
    name: 'github-actions',
    link: '[@github-actions](https://github.com/apps/github-actions)',
  },
  commit: {
    hash: '65810fdd21ad34a2b06e42e977480bbfade20375',
    message: 'chore: version packages',
    link: '[`65810fd`](https://github.com/culur/culur/commit/65810fdd21ad34a2b06e42e977480bbfade20375)',
  },
  pullRequest: {
    number: 17,
    title: 'chore: version packages',
    link: '[#17](https://github.com/culur/culur/pull/17)',
  },
};

const pullRequestInfo = {
  user: {
    name: 'github-actions',
    link: '[@github-actions](https://github.com/apps/github-actions)',
  },
  commit: {
    hash: '0a8933299dacec0fe2ad79e20c6e117d13e1ad81',
    message: 'chore: version packages',
    link: '[`0a89332`](https://github.com/culur/culur/commit/0a8933299dacec0fe2ad79e20c6e117d13e1ad81)',
  },
  pullRequest: {
    number: 5,
    title: 'chore: version packages',
    link: '[#5](https://github.com/culur/culur/pull/5)',
  },
};

🗃️ Changelog

See CHANGELOG for more information on what has changed recently.

🔒 License

See LICENSE for license rights and limitations (MIT).

1.1.9

10 months ago

1.1.8

10 months ago

1.1.7

10 months ago

1.1.6

11 months ago

1.1.5

12 months ago

1.1.4

12 months ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.10

10 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago