GithubHelp home page GithubHelp logo

n0th1ng-else / semantic-release-pr-analyzer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 158 KB

The same as @semantic-release/commit-analyzer and @semantic-release/release-notes-generator but for Pull Request description

Home Page: https://www.npmjs.com/package/semantic-release-pr-analyzer

License: MIT License

JavaScript 100.00%

semantic-release-pr-analyzer's Introduction

semantic-release-pr-analyzer

semantic-release plugin that imitates the behaviour when the team relies on the squash and merge strategy on GitHub.

Install

$ npm install semantic-release-pr-analyzer -D

Usage

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

{
  "plugins": [
    [
      "semantic-release-pr-analyzer",
      {
        "strategy": "github"
      }
    ]
  ]
}

Configuration

Options

Option Description Default
strategy analyzing strategy github
commitAnalyzerConfig standard commit-analyzer plugin configuration default one for commit-analyzer
notesGeneratorConfig standard release-notes-generator plugin configuration default one for release-notes-generator

Strategy

GitHub strategy ({strategy: 'github'})

Once PR is merged, GitHib creates a squash commit in the main branch following the rules below:

Number of commits in the pull request Main Branch Commit Title Main Branch Commit Description
Single commit The title of the commit message for the single commit, followed by the pull request number The body text of the commit message for the single commit
More than one commit The pull request title, followed by the pull request number A list of the commit messages for all of the squashed commits, in date order

You can read more about this in the official GitHub docs. This plugin hijacks semantic-release flow and replaces the commits list with the one that respects these rules into the mix.

Strict GitHub strategy ({strategy: 'strict-github'})

The same as the GitHub strategy, but it will throw an error if the first commit title is not equal to the pull request title.

Pull Request strategy ({strategy: 'pull-request'})

Always analyzes the pull request title and description as a commit.

Strict Pull Request strategy ({strategy: 'strict-pull-request'})

The same as the Pull Request strategy, but it will throw an error if the first commit body is not equal to the pull request description.

Environment variables

env.GITHUB_TOKEN

GitHub token to access your repository. Using the secrets.GITHUB_TOKEN value should be enough.

env.GITHUB_PR_NUMBER

The pull request number. In the context of GitHub actions, it is achievable as github.event.pull_request.number

env.GITHUB_REPOSITORY

Repository path, for example n0th1ng-else/semantic-release-pr-analyzer. For GitHub actions workflow it is set automatically.

Examples

You can see the sample configuration in the examples folder.

semantic-release-pr-analyzer's People

Contributors

n0th1ng-else avatar

Stargazers

TED Vortex (Teodor-Eugen Duțulescu) avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.