GithubHelp home page GithubHelp logo

changelogithub's Introduction

changelogithub

NPM version

Generate changelog for GitHub releases from Conventional Commits, powered by changelogen.

👉 Changelog example

Features

  • Support exclamation mark as breaking change, e.g. chore!: drop node v10
  • Grouped scope in changelog
  • Create the release note, or update the existing one
  • List contributors

Usage

In GitHub Actions:

# .github/workflows/release.yml

name: Release

permissions:
  contents: write

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - uses: actions/setup-node@v3
        with:
          node-version: 16.x

      - run: npx changelogithub # or [email protected] if ensure the stable result
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

It will be trigged whenever you push a tag to GitHub that starts with v.

Configuration

You can put a configuration file in the project root, named as changelogithub.config.{json,ts,js,mjs,cjs}, .changelogithubrc or use the changelogithub field in package.json.

Preview Locally

npx changelogithub --dry

Why?

I used to use conventional-github-releaser for almost all my projects. Until I found that it does NOT support using exclamation mark for breaking changes - hiding those important breaking changes in the changelog without the awareness from maintainers.

License

MIT License © 2022 Anthony Fu

changelogithub's People

Contributors

497363983 avatar antfu avatar eliamartani avatar frostming avatar hyoban avatar innocenzi avatar intevel avatar larchliu avatar matyifkbt avatar romanhrynevych avatar sxzz avatar waleed-kh avatar zcong1993 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

changelogithub's Issues

Allow output option without token

Clear and concise description of the problem

Currently, the output option must be used with a provided token. But actually, it can run without token so that we can use this option to maintain a CHANGELOG file or preview the change log locally without a step to get the github token and use the useless option -t in this case.

Suggested solution

In my opinion, it is easy to implement:

From:

     if (!config.token) {
        console.error(red('No GitHub token found, specify it via GITHUB_TOKEN env. Release skipped.'))
        process.exitCode = 1
        printWebUrl()
        return
      }

      if (typeof config.output === 'string') {
        await fs.writeFile(config.output, md, 'utf-8')
        console.log(yellow(`Saved to ${config.output}`))
        return
      }

To:

      if (typeof config.output === 'string') {
        await fs.writeFile(config.output, md, 'utf-8')
        console.log(yellow(`Saved to ${config.output}`))
        return
      }

     if (!config.token) {
        console.error(red('No GitHub token found, specify it via GITHUB_TOKEN env. Release skipped.'))
        process.exitCode = 1
        printWebUrl()
        return
    }

Alternative

No response

Additional context

No response

Validations

403 forbidden

Hello! Sorry if this is not related to the repo but I hope it's ok that I ask this here.

In this example GitHub action usage.. do we need to set the token for ${{secrets.GITHUB_TOKEN}} somewhere?

This happens whenever I try to do a release...

Run npx changelogithub
npm WARN exec The following package was not found and will be installed: changelogithub
changelogithubv0.12.1
v0.2.11 -> v0.2.1[2](https://github.com/walmartwarlord/foodapp/runs/7167987099?check_suite_focus=true#step:4:7) (1 commits)
--------------
--------------
Creating release notes...
FetchError: 403 Forbidden (https://api.github.com/repos/walmartwarlord/foodapp/releases)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async sendRelease (file:///home/runner/.npm/_npx/b22f3b69[8](https://github.com/walmartwarlord/foodapp/runs/7169182091?check_suite_focus=true#step:4:9)9da43b0/node_modules/changelogithub/dist/chunks/generate.mjs:28:15)
    at async CAC.<anonymous> (file:///home/runner/.npm/_npx/b22f3b69[9](https://github.com/walmartwarlord/foodapp/runs/7167987099?check_suite_focus=true#step:4:10)db43a0/node_modules/changelogithub/dist/cli.mjs:39:5)
Error: Process completed with exit code 1.

No significant changes if patch the release

This is my config, first use actions/create-release@v1 create release and this action will output a upload_url for next step which upload asset, and then npx changelogithub will got No significant changes.

image

image

It compare:

0b8521fe555b4cd47c93e4a051ac197d8d4d4506 -> v3.31.0 (0 commits)

v3.31.0 hash is 0b8521fe555b4cd47c93e4a051ac197d8d4d4506, so compare itself with itself. and got nothing else.

     - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          draft: false
          prerelease: false
      - run: npx changelogithub
        continue-on-error: true
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
      - name: Upload Release Asset
        id: upload-release-asset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./release.zip
          asset_name: release-${{ matrix.os }}.zip
          asset_content_type: application/zip

feat: publish to Github Actions

As mentioned in README, we use changelogithub in the Github Actions. But now, we should depend this package directly in the package.json.

We can build another version for the usage as a Github Actions, like

# - run: npx changelogithub
#  env:
#    GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: antfu/changelogithub@v0

I think it will be better :)

Enable cli for Github Enterprise

Clear and concise description of the problem

When I tried to implement a github action with this plugin, I couldn't because it is designed only for github.com. Not only config definition fails e.g. Error: Can not parse GitHub repo from url but also the endpoint always referes to github.com making it difficult to add in projects inside Github Enterprise

Suggested solution

Add two additional properties in the config to override the default urls so the endpoints will work no matter which Github environment it is.

changelogithub.config.ts
export default {
  baseUrl: "git.custom.com", // default: github.com
  baseUrlApi: "git.custom.com/api/v3", // default: api.github.com
  repo: "eliamartani/myrepo",
};

I honestly couldn't think of a better suggestion to change the repo validation so that's why I put the repo in the example

Alternative

Right now, the only alternative I found is changelogen but I need to create a release manually.

Additional context

No response

Validations

Bug: git log fail at the first tag

I think it fails to find previous tag when using it at the first time.

Reproduction

  1. Create a test github repo and commit something
  2. git tag v1.0.0
  3. npx changelogithub --dry

See logs below:

changelogithub v0.6.5
Error: Command failed with exit code 128: git --no-pager log undefined...v1.0.0 --pretty="----%n%s|%h|%an|%ae%n%b" --name-status
fatal: ambiguous argument 'undefined...v1.0.0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Why always No significant changes?

Describe the bug

I'm first to use this tool to auto release on github.

But every time release content is:

image

I see https://github.com/antfu/unplugin-vue-components changelog is:

image

Reproduction

https://github.com/tjx666/unplugin-externalize-deps/releases

System Info

Not need

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Merge with unjs/changelogen?

Hey! Nice work on this idea. If you like to, I think would be nice to have action command directly from one package. I plan to expose some more features from changelogen such as server output and version bumps so makes sense to extend it :)

Request: Remove the limit of tag name?

Currently, the generator checks if a ref is a tag by looking at the first letter, if it isn't v, the process will abort.

if (!config.to.startsWith('v')) {
console.log(yellow(`Current ref "${bold(config.to)}" is not a version tag. Release skipped.`))
process.exitCode = 1
return
}

It seems not ideal and will prevent it from being adopted by existing workflows.

Maybe we can remove this limit by changing to a more robust checking method, such as the full name of the ref (refs/tag/${tagname}).

Add an option to use only merge commits

Clear and concise description of the problem

I wish the changelog could be generated using only merge commit (git log --merges) to have a tool more inclusive for those want do not want use squash merges.

Suggested solution

Add an option which add the --merges to git commands.

Alternative

No response

Additional context

Not sure if this issue must be here or at unjs/changelogen#62

Validations

Get wrong latest tag if we have different-rule tag

Hi, I have a project and have lots of tags. Not all of the tags is starts with v. E.g.

page_v3.19.1
v3.19.2
page_v3.19.2
v3.19.3
page_v3.19.3
v3.19.4
page_v3.19.4
v3.19.5
page_v3.19.5
v3.19.6
page_v3.19.6
v3.19.7
page_v3.19.7
v3.20.0
page_v3.20.0
v3.20.1
page_v3.20.1
v3.21.0
page_v3.21.0

The prefix with page_v is have nothing to do with v, I want to compare prefixes with v, not page_v. But I found the code, It always gets the latest tag and did not do anything to filter and compares newer tag.

export async function getLastGitTag(delta = 0) {

Not create a release

Describe the bug

Hello, I'm adding a GitHub Action to a private repository. I'm creating the tag and uploading it correctly with the bumpp library, but when the GitHub Action runs, it returns that it can't find the tag and skips the release. I've attached some screenshots.
SCR-20240418-jcat
image

Reproduction

Not link to reproduce because it's a private repository.

System Info

System:
    OS: macOS 14.3.1
    CPU: (10) x64 Apple M1 Pro
    Memory: 17.59 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.12.1/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 123.0.6312.124
    Safari: 17.3.1

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Generate/Upudate CHANGELOG.md file

Clear and concise description of the problem

This package is really useful and I am using it for my OSS project. However, my company maintains CHANGELOG.md file and changelogithub doesn't generate/update changelog.md file.

Suggested solution

Maybe passing file option to update the changelog file

Alternative

N/A

Additional context

Thanks so much for your tools ❤️

Validations

After releasing returns the new created release id.

Clear and concise description of the problem

Is it possible to get the release id after success updating the changelog?
By create-release, it returns some outputs.
By using the release id, i can do further build like this.

Or is there any other way to generate the changelog and to release builds at the same time?
Thanks!

Suggested solution

Noting to suggest on codes. Just wish to simplify the process of releasing and building.

Alternative

No response

Additional context

No response

Validations

Could I release a file with changelogithub?

Clear and concise description of the problem

To release with a file by changelogithub.
I am using it for a tauri-app and I want to release with a compiled file.

Suggested solution

maybe like:

- run: npx changelogithub
  env:
    GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
  with:
    files: ['./dist/index.js', './src-tauri/target/release/app.exe']

Alternative

No response

Additional context

No response

Validations

Hide contributors by default, or replace by "new contributors"

Hey,

Before PRing I wanted to ask if this would be considered - currently, changelogithub outputs a "Contributors" section by default, even though GitHub's releases already has that enabled:

image

It's kind of a duplication so I thought disabling it by default would be better.

Another idea would be to replace "Contributors" with a "New contributors" section, which I think would make more sense (and that's what GitHub's auto-release note feature does too).

image

I'm willing to try and PR that if I have your go. :)

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.