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

@joedoyle23/semantic-release-github-pullrequest

v0.1.1

Published

semantic-release plugin to create a github pullrequest

Downloads

164

Readme

semantic-release-github-pullrequest

This plugin is a plugin for semantic-release.

It automatically creates a pull request containing changes for any files you want to publish in your repository, like release notes of your newly published release.

npm npm Build Code coverage Lines of Code License

| Step | Description | | ------------------ | ------------------------------------------------------------------------------------------------ | | verifyConditions | Verify that all needed configuration is present. | | publish | Create a branch to upload all assets and create the pull request on the base branch on GitHub. |

Install

Add the plugin to your npm-project:

npm install semantic-release-github-pullrequest -D

Usage

The plugin can be configured in the semantic-release configuration file:

{
  "plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    [
      "semantic-release-github-pullrequest", {
        "assets": ["CHANGELOG.md"],
        "baseRef": "main"
      }
    ]
  ]
}

With this example, a GitHub pull request will be created, with the content of CHANGELOG.md file, on the main branch.

Configuration

GitHub authentication

The GitHub authentication configuration is required and can be set via environment variables.

Follow the Creating a personal access token for the command line documentation to obtain an authentication token. The token has to be made available in your CI environment via the GH_TOKEN_RELEASE or GH_TOKEN environment variable. The user associated with the token must have push permission to the repository.

When creating the token, the minimum required scopes are:

Note on GitHub Actions: You can use the default token which is provided in the secret GITHUB_TOKEN. However no workflows will be triggered in the Pull Request, providing it to be merged. You can use GH_TOKEN or GITHUB_TOKEN with the secret GITHUB_TOKEN to create the release, and use GH_TOKEN_RELEASE with this plugin to create the Pull Request.

Environment variables

| Variable | Description | | -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | GH_TOKEN_RELEASE, GH_TOKEN or GITHUB_TOKEN | Required. The token used to authenticate with GitHub. | | GITHUB_API_URL or GH_URL or GITHUB_URL | The GitHub Enterprise endpoint. | | GH_PREFIX or GITHUB_PREFIX | The GitHub Enterprise API prefix. | | GH_SHA or GITHUB_SHA | The commit sha reference to create the new branch for the pull request. On GitHub Actions, this variable is automatically set. |

Options

| Option | Description | Default | | :-------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------- | | githubUrl | The GitHub Enterprise endpoint. | GH_URL or GITHUB_URL environment variable. | | githubApiPathPrefix | The GitHub Enterprise API prefix. | GH_PREFIX or GITHUB_PREFIX environment variable. | | proxy | The proxy to use to access the GitHub API. Set to false to disable usage of proxy. See proxy. | HTTP_PROXY environment variable. | | assets | Required.. An array of files to upload to the release. See assets. | - | | branch | Name of the branch that will be created in the repository. | semantic-release-pr<%= nextRelease.version ? \-${nextRelease.version}` : "" %> | |pullrequestTitle | Title for the pull request. This title will also be used for all commit created to upload the assets. See [pullrequestTitle](#pullrequestTitle). |chore(release): update release<%= nextRelease.version ? ` ${nextRelease.version}` : "" %>| |labels | The [labels](https://help.github.com/articles/about-labels) to add to the pull request created. Set tofalseto not add any label. |['semantic-release'] | |baseRef | The base branch used to create the pull request (usuallymainormaster). | main` |

proxy

Can be false, a proxy URL or an Object with the following properties:

| Property | Description | Default | |---------------|----------------------------------------------------------------|--------------------------------------| | host | Required. Proxy host to connect to. | - | | port | Required. Proxy port to connect to. | File name extracted from the path. | | secureProxy | If true, then use TLS to connect to the proxy. | false | | headers | Additional HTTP headers to be sent on the HTTP CONNECT method. | - |

See node-https-proxy-agent and node-http-proxy-agent for additional details.

proxy examples

'http://168.63.76.32:3128': use the proxy running on host 168.63.76.32 and port 3128 for each GitHub API request. {host: '168.63.76.32', port: 3128, headers: {Foo: 'bar'}}: use the proxy running on host 168.63.76.32 and port 3128 for each GitHub API request, setting the Foo header value to bar.

assets

Can be a glob or and Array of globs and Objects with the following properties:

| Property | Description | Default | | -------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------ | | path | Required. A glob to identify the files to upload. | - | | name | The name of the downloadable file on the GitHub release. | File name extracted from the path. | | label | Short description of the file displayed on the GitHub release. | - |

Each entry in the assets Array is globbed individually. A glob can be a String ("dist/**/*.js" or "dist/mylib.js") or an Array of Strings that will be globbed together (["dist/**", "!**/*.css"]).

If a directory is configured, all the files under this directory and its children will be included.

The name and label for each assets are generated with Lodash template. The following variables are available:

| Parameter | Description | |---------------|-------------------------------------------------------------------------------------| | branch | The branch from which the release is done. | | lastRelease | Object with version, gitTag and gitHead of the last release. | | nextRelease | Object with version, gitTag, gitHead and notes of the release being done. | | commits | Array of commit Objects with hash, subject, body message and author. |

Note: If a file has a match in assets it will be included even if it also has a match in .gitignore.

pullrequestTitle

The title of the pull request is generated with Lodash template. The following variables are available:

| Parameter | Description | |---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | branch | Object with name, type, channel, range and prerelease properties of the branch from which the release is done. | | lastRelease | Object with version, channel, gitTag and gitHead of the last release. | | nextRelease | Object with version, channel, gitTag, gitHead and notes of the release being done. | | releases | Array with a release Objects for each release published, with optional release data such as name and url. |