fregante / release-with-changelog Goto Github PK
View Code? Open in Web Editor NEWCreates GitHub releases for pushed tags, with the commit log as release body
License: MIT License
Creates GitHub releases for pushed tags, with the commit log as release body
License: MIT License
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.
I’m getting an odd error:
Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
nothing I’ve googled seems directly applicable, I’m using the standard config in this file, and I created the package.json.
Any ideas what’s up?
https://github.com/datapolitical/chrisfnicholson.github.io/actions/runs/448268906
i see the release sorted in unusal order
tag that was 10 hours ago - 0.0.2-8 is appear after 0.0.2-18
Hey fregante,
I would like to request to add draft and prerelease option as in many other create release Github Actions.
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.
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.
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
<hr>
or \n\n
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})'
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?
Hello I’ve been testing this today however it seems that each time it misses the first commit of the group.
Crude example can be found: https://github.com/fredbradley/actions-test/releases/tag/v0.3.1
but when you see the compare you see it’s three commits not two.
exclude: true
should mean
exclude: '^Meta|^Document|^Readme|readme$|^Lint|^Refactor|^Update.+dependencies$|^\d\.\d\.\d'
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))
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.```
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 }}
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
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 😄
"Error: Resource not accessible by integration"
Received after adding the following code to my repo - soraro/tmpnotes#30
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.
https://github.com/actions/upload-release-asset can be used to attach files to releases, but it takes an "upload url" as parameter.
release-with-changelog
should output this URL as well: https://docs.github.com/en/rest/reference/repos#upload-a-release-asset
Apparently it can be generated easily with just the release ID, which this action already has access to
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.
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:
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}
❤
npm version
creates a commit that shouldn't appear:
vercel/release automatically excludes it already:
https://github.com/fregante/github-url-detection/releases
With a regex I'd be able to also exclude Meta:
commits from Refined GitHub:
- uses: notlmn/release-with-changelog@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude: '^Meta:|^Docs:'
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
See the readme: https://github.com/fregante/release-with-changelog#deprecated
I'm opening this issue to keep track of this feature as discussed in refined-github/github-url-detection#30 and refined-github/refined-github#3421
Currently this action only supports the on.push.tag
event
I think the docs should include:
on.push.tags
, apparentlyrelease.yml
fileThere should be a flag to tell it not to create the release when there are no commits to display.
It will be useful if releases will only be created when certain types of commits are made.
- 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
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.