npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@culur/changesets-github-info

v1.1.1

Published

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

Downloads

336

Readme

@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).