Git Product home page Git Product logo

release-with-changelog's People

Contributors

belked avatar denvercoder1 avatar dependabot[bot] avatar fregante avatar notlmn avatar saibamen 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

Watchers

 avatar  avatar  avatar  avatar

release-with-changelog's Issues

Author placeholder/replacement

Hey fregante,

I would like to request to add author placeholder/replacement of commit. You could add this placeholder – {author} to commit-template where it will "print" author name. You could add it like follows:

...
- name: Create release with authors
  uses: fregante/release-with-changelog@v3
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    commit-template: '- {hash} {title} {author}'

And it will produce release with text - 6e89f5c Update user in examples @fregante:

It's better to see it written in changelog or in mail notification, not just after hovering or opening commit.

Add tests

In my latest action I extracted the core function and tested that using the setup from the original action template.

For this action, perhaps you could extract and test the commit-to-notes part, which is the core feature:

function generateReleaseNotes({commits, commitTemplate, releaseTemplate}) {
	const commitEntries = [];
	if (commits.length === 0) {
		commitEntries.push('_Maintenance release_');
	} else {
		for (const {hash, title} of commits) {
			const line = commitTemplate
				.replace('{hash}', hash)
				.replace('{title}', title)
				.replace('{url}', repoURL + '/commit/' + hash);
			commitEntries.push(line);
		}
	}
	return releaseTemplate
				.replace('{commits}', commitEntries.join('\n'))
				.replace('{range}', `[\`${range}\`](${repoURL}/compare/${range})`)
}

Testing the git part is harder and requires mocking, but this shouldn't be too difficult.

Date placeholder/replacement

Hey fregante,

I would like to request to add date placeholder/replacement of commit. You could add this placeholder – {date} to commit-template where it will "print" date of commit and adds link to commit on it. You could add it like follows:

...
- name: Create release with date
  uses: fregante/release-with-changelog@v3
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    commit-template: '- {date} {title}'

And it will produce release with text - [4.2.2021](https://github.com/fregante/release-with-changelog/commit/6e89f5c9d6622f54ca284c06aa89fa7391cd86f7) Update user in examples:

It's better to have date (pointing to commit) instead of commit hash in changelog or in mail notification.

Group by PR label

This is probably not an easy feature, but it might make the release notes a little better.

What if it used some PR’s labels to group the commits?

with:
  labels:
    - breaking change
    - bug
    - enhancement
  1. Fetch the each commit’s PR’s labels
  2. Add commit to the first matching label (e.g. add it only to "breaking change" if it also has "bug")
  3. Append PR-less commits at the end, after a <hr> or \n\n

Let the user specify a per-commit template

Instead of using include-hash, this could allow a per-commit template so the user can customize it freely

with:
  template: '- {hash} {title}' # Default
with:
  template: '- {title} {hash}'
with:
  template: '{title} [🔗]({url})'

Pattern for latest tag compare

Hi, I get an error like this

Run fregante/release-with-changelog@v3
  with:
    token: ***
    exclude: ^meta|^document|^lint|^refactor|readme|dependencies|注释|文档|ci|CI|README
    commit-template: - {title} ← {hash}
    template: ### Changelog
  
  {commits}
  
  {range}
  
    date-format: short
    sort: desc
Computed range: v1.1.1..dev-latest
Error: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}

It seems that already have "dev-latest" in the last commit.

Can you add tag extract pattern like the tag should start with "v" to avoid the bug?

Have a `exclude` preset

exclude: true

should mean

exclude: '^Meta|^Document|^Readme|readme$|^Lint|^Refactor|^Update.+dependencies$|^\d\.\d\.\d'

ReferenceError: module is not defined

Action fails with following message.

Run fregante/[email protected]
  with:
    token: ***
    draft: true
    exclude: ^Merge|^terraform-docs:
    prerelease: false
    commit-template: - {title} ({hash})
    template: ### Changelog
  
  {commits}
  
  {range}
  
    date-format: short
    sort: desc
    skip-on-empty: false
file:///home/runner/work/_actions/fregante/release-with-changelog/v3.5.1/distribution/index.js:1
module.exports =
^

ReferenceError: module is not defined
    at file:///home/runner/work/_actions/fregante/release-with-changelog/v3.5.1/distribution/index.js:1:1
    at ModuleJob.run (internal/modules/esm/module_job.js:145:37)
    at async Loader.import (internal/modules/esm/loader.js:18[2](https://github.com/my-org/my-repo/runs/5883732283?check_suite_focus=true#step:7:2):2[4](https://github.com/my-org/my-repo/runs/5883732283?check_suite_focus=true#step:7:4))
    at async Object.loadESM (internal/process/esm_loader.js:68:[5](https://github.com/my-org/my-repo/runs/5883732283?check_suite_focus=true#step:7:5))

Latest tag fails to create release

Getting an error with the latest tag, although the action step still reports success. The release is not created.

Download action repository 'fregante/release-with-changelog@v3' (SHA:304ef3a41972f031ea67fa705ed37a811f37d1b1)

  with:
    token: ***
    exclude: ^Update\s\S+\.(md|yml)$
    tag: v0.9.4-alpha
    draft: true
    template: ### Changelog
  
  {commits}
  
  {range}
  
    commit-template: - {hash} {title}
    date-format: short
    sort: desc
    prerelease: false
    skip-on-empty: false
(node:1621) Warning: require() of ES modules is not supported.
require() of /home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/runner/work/_actions/fregante/release-with-changelog/v3/package.json.
(node:1621) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'setFailed' of undefined
    at run (/home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js:323:17)
    at Module.52 (/home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js:327:1)
    at __webpack_require__ (/home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js:24:31)
    at startup (/home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js:43:19)
    at /home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js:49:18
    at Object.<anonymous> (/home/runner/work/_actions/fregante/release-with-changelog/v3/distribution/index.js:52:10)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
(node:1621) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:1621) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```

Error on protected branch: could not read Username for 'https://github.com/'

Hi,

Im using branch protection on master, but allowing bypass to a user with a PAT set to ${{ secrets.BYPASS }}

The below pipeline fails on the release step with this error. If there a work around? I believe its the checkout@2 setting persist-credentials: false thats causing the error, but without it i cant get the Automated Version Bump step.

Run fregante/release-with-changelog@v3
Error: Command failed: git fetch origin +refs/tags/*:refs/tags/*
fatal: could not read Username for 'https://github.com/': No such device or address

Pipeline.yml

name: Push

on:
  push:
    branches: [ master ]
  workflow_dispatch:

jobs:
  push:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source code
        uses: 'actions/checkout@v2'
        with:
          ref: ${{ github.ref }}
          persist-credentials: false
          fetch-depth: 50

      - name: Automated Version Bump
        id: version-bump
        uses: 'phips28/gh-action-bump-version@master'
        env:
          GITHUB_TOKEN: ${{ secrets.BYPASS }}
        with:
          skip-tag: 'false'

      - name: Tag Changelog
        uses: fregante/release-with-changelog@v3
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

release-with-changelog@main does not load after update to node16

Change occurred in 822c4b2

Release set-up errors:

System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
(Parameter ''using: node16' is not supported, use 'docker' or 'node12' instead.')
at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext,
TemplateContext templateContext, TemplateToken inputsToken, String fileRelativePath, MappingToken outputs)
at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile)
--

Fail to load fregante/release-with-changelog/main/action.yml

Custom release title

Hey fregante,

I would like to request to add custom title option. Default it will be just tag name ({tag}). You could change it like follows:

...
- name: Create release with custom title
  uses: fregante/release-with-changelog@v3
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    title: Version {tag}

That will produce release with title Version 3.1.0 (when is tag 3.1.0).

PS: Thanks for making very useful Github Action. It helps me a lot 😄

Missing option for contributors list

Hi, Thanks for building this awesome action. I am a newbie in github actions and it workflows. Can you tell how to add contributors in the release list.

Reverse sort option

Hey fregante,

I would like to request to add sort by date option. In this option you could set if you want to sort commits ascending (from older to newer) or descending (from newer to older – like now and it will be default). You could change it like follows:

...
- name: Create release with commits sorted ascending 
  uses: fregante/release-with-changelog@v3
  with:
    token: ${{ secrets.GITHUB_TOKEN }}
    sort: ascending

That will produce release with body, where will be commits sorted ascending (from older to newer).
I think, it's better to have commits sorted ascending – you could look on "development process" and it's better for understanding what happened.

Use native GitHub release generator

This would be a big change, but I think it makes sense (especially because it would save us from release notes generation bugs and further requests).

The v3 of this action and the underlying generator can be forked as they're released under MIT.

Such change would let us drop most of the current code and replace it with: https://github.com/MylesBorins/node-osc/blob/v6.1.11/.github/workflows/create-release.yml#L26-L41

The native generator can be configured separately from this action as well, so most options except title, draft and prerelease can be dropped as well.

It would close:

Context:

commit-template {date} variable failing

I can't get the {date} to show up in the commit-template.

Code in my action:

     - uses: fregante/release-with-changelog@v3
        with:
          tag: ${{ steps.tag_version.outputs.new_tag }}
          token: ${{ secrets.GITHUB_TOKEN }}
          commit-template: '- {date} {title} ← {hash}'
          template: |
              ### Changelog
              {commits}

              Compare: {range}

              ❤

Output
image

ReferenceError: module is not defined

Here is my release.yml file

name: Release

on:
  push:
    # Sequence of patterns matched against refs/tags
    tags:
      - '[0-9]+.[0-9]+.[0-9]+' # Push events to any matching semantic tag. For example, 1.10.1 or 2.0.0.

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Changelog
        uses: fregante/[email protected]
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          exclude: '^build:|^chore:|^ci:|^docs:'
          commit-template: '- {title} ← {hash}'
          template: |
              ### Release Notes

              {commits}

              {range}

              🚀
        id: Changelog
      - name: Create release
        id: create_release
        uses: actions/create-release@latest
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ github.ref }}
          body: |
            ${{ steps.Changelog.outputs.changelog }}
          draft: false
          prerelease: false

However when my workflow is being executed on GitHub, I get the following error at the Changelog step:

Run fregante/[email protected]
file:///home/runner/work/_actions/fregante/release-with-changelog/v3.5.1/distribution/index.js:1
module.exports =
^

ReferenceError: module is not defined
    at file:///home/runner/work/_actions/fregante/release-with-changelog/v3.5.1/distribution/index.js:1:1
    at ModuleJob.run (internal/modules/esm/module_job.js:145:37)
    at async Loader.import (internal/modules/esm/loader.js:182:24)
    at async Object.loadESM (internal/process/esm_loader.js:68:5)

Any ideas why this might be happening and what I can do to fix it?

Thanks

Improve documentation

I think the docs should include:

  • What happens if a tag already has a release? Is it overridden?
  • What events are supported? Currently only on.push.tags, apparently
  • A full workflow is always welcome. Perhaps it should link to its own release.yml file

The options don't work

https://github.com/sindresorhus/refined-github/blob/18387e73251a024b26bb7d58f77d33bcae15b4cd/.github/workflows/deployment.yml#L27

      - uses: notlmn/release-with-changelog@v2
        with:
          include-range: false
          token: ${{ secrets.GITHUB_TOKEN }}

Generated:

- [`18387e73`](https://github.com/sindresorhus/refined-github/commits/18387e73251a024b26bb7d58f77d33bcae15b4cd) Add `stop-pjax-loading-with-esc` feature (#3465)
- [`d8c1c195`](https://github.com/sindresorhus/refined-github/commits/d8c1c195cfdff5031fda6dc688ba36828e9d7d49) Remove `deinit` in `remove-label-faster` (#3538)
- [`2dc5f263`](https://github.com/sindresorhus/refined-github/commits/2dc5f263b97730b82ceee8cb64edc5da76fe5893) Purge expired cache items
- [`760abcfc`](https://github.com/sindresorhus/refined-github/commits/760abcfc4b2db013340241f87175a7b91ac11403) Correctly dim `bot` label in `dim-bots` (#3532)
- [`c254e559`](https://github.com/sindresorhus/refined-github/commits/c254e5596b852fa4b73177481bebc182f321b5d0) Ensure `batch-open-conversations` always adds every checkbox

[`20.9.4.1817..20.9.10`](https://github.com/sindresorhus/refined-github/compare/20.9.4.1817..20.9.10)

include-range is set to false, but the link is still included

Extract `generate-release-notes.js` into module and cli

With vercel/release not being updated and sindresorhus/np having its own release creator, I feel that this is a good opportunity to extract this generator into its own API and CLI modules so perhaps it can be used by third parties as well, and developed/tested autonomously.

This is just a remind-to-self task, no help needed.

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.