Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
318a4bf
feat(commits): let the commit messages be sent in as input for more o…
Fresa May 31, 2022
21c5af5
fix inconsistent code style
Fresa May 31, 2022
e41c101
find the start of the release when on a dev branch
Fresa Jun 1, 2022
36aac1f
fix bash formatting of git log
Fresa Jun 1, 2022
d2ec0f5
add missing tag specification
Fresa Jun 1, 2022
7ac58fd
ci: use path to commits parameter
Fresa Jun 1, 2022
358e636
use the whole error message when failing
Fresa Jun 1, 2022
929910b
remvoe unused github dependency
Fresa Jun 1, 2022
e29a532
test what is causing node to fail with Parameter token or opts.auth i…
Fresa Jun 1, 2022
ef5a295
remove everything and try if it still fails
Fresa Jun 1, 2022
3cbff90
add back the github token input
Fresa Jun 1, 2022
ecb7a0f
Revert "add back the github token input"
Fresa Jun 1, 2022
9543a0a
Revert "remove everything and try if it still fails"
Fresa Jun 1, 2022
571e68d
Revert "test what is causing node to fail with Parameter token or opt…
Fresa Jun 1, 2022
51bbc37
ci: testing the fetching of the action artifact overwrites the build …
Fresa Jun 1, 2022
2f082a2
ci: the log format is missing a comma
Fresa Jun 1, 2022
a916b7f
fix: consolidate confusing input
Fresa Jun 2, 2022
abba4db
add missing input of path_to_commits
Fresa Jun 2, 2022
6f661ff
fix ci references and write release notes both to stdout and file
Fresa Jun 2, 2022
ff3b1a2
ignore null logs
Fresa Jun 2, 2022
c7141dd
set main as release branch
Fresa Jun 2, 2022
2819709
bump major version to move out of alpha
Fresa Jun 2, 2022
362d113
doc: update v0 to v1 changes in README
Fresa Jun 3, 2022
17a3294
doc: improve the description of path_to_commits
Fresa Jun 3, 2022
6913804
doc: format README
Fresa Jun 3, 2022
97d7854
ci: fix verifying if current commit is a merge commit
Fresa Jun 3, 2022
0bd6482
Merge pull request #7 from Fresa/read-raw-commit-messages
Fresa Jun 3, 2022
432dfc9
remove pre release
Fresa Jun 3, 2022
182bc29
Merge branch 'main' into read-raw-commit-messages
Fresa Jun 3, 2022
78160d2
Merge pull request #8 from Fresa/read-raw-commit-messages
Fresa Jun 3, 2022
0df8d02
fix: update to nodejs 16 as nodejs 12 has been deprecated
Fresa Dec 1, 2022
19d2f22
chore: update dependencies to latest version
Fresa Dec 1, 2022
f0883c6
update package lock file
Fresa Dec 1, 2022
96a8d5f
Merge pull request #10 from Fresa/update-nodejs-version
Fresa Dec 1, 2022
eef1755
ci: use trunk based release versioning instead of gitversion
Fresa Dec 22, 2022
a1079a4
test if it is possible to fetch input in the pre fetch script
Fresa Dec 22, 2022
1faaf3e
include actions/core node module
Fresa Dec 22, 2022
5ccee26
try getting github token directly from ENV
Fresa Dec 22, 2022
e66e4e7
use the repos github token to test fetching artifacts
Fresa Dec 29, 2022
1dba7bc
format
Fresa Dec 29, 2022
581d7b3
ci: adjust ref and sha paramters to reference the versioning step
Fresa Dec 29, 2022
23441b7
feat(rate limiting): use the github bearer token to authenticate requ…
Fresa Dec 29, 2022
3bfcc89
remove the actions node module as it's not needed
Fresa Dec 29, 2022
ae64cb5
Merge pull request #11 from Fresa/use-github-token-for-pre-fetch
Fresa Dec 29, 2022
0367d4d
fix(nodejs): upgrade to Node 20 as 16 is deprecated for Github Actions
Fresa Aug 16, 2024
73e728b
ci: bump action versions and ignore tag push
Fresa Aug 16, 2024
bae8266
ci: fix github script reference
Fresa Aug 16, 2024
ecac688
Merge pull request #12 from Fresa/bump-nodejs
Fresa Aug 16, 2024
4697f7c
fix(fetch artifact): redirects from github responds with 403 so remov…
Fresa Jul 16, 2025
a2a26e6
Merge pull request #13 from Fresa/handle-redirects
Fresa Jul 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions .github/version_config.yml

This file was deleted.

113 changes: 55 additions & 58 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,99 +4,96 @@ on:
push:
branches:
- '**'

tags-ignore:
- '**'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
# Fetches entire history, so we can analyze commits since last tag
fetch-depth: 0
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
node-version: 12
node-version: 16
- name: Test Fetching Artifact
run: |
GITHUB_ACTION_REPOSITORY=Fresa/release-notes-generator \
GITHUB_ACTION_REF=vTEST \
INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
node fetch_artifact.js
- name: Clean dist
run: |
rm -rf dist
- name: Install
run: npm ci
- name: Check
run: npm run prettier-check
- name: Build
run: npm run publish
- name: Test Fetching Artifact
run: |
GITHUB_ACTION_REPOSITORY=Fresa/release-notes-generator \
GITHUB_ACTION_REF=vTEST \
node fetch_artifact.js
- name: Assert Artifact Downloaded
run: ls -d $GITHUB_WORKSPACE/dist/index.js
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
configFilePath: .github/version_config.yml
- name: Determine Release Info
id: release
- name: Determine Release Version
id: versioning
uses: Fresa/trunk-based-release-versioning@v0
- name: Determine Release Tag
id: release-tag
run: |
from_tag=$(git tag --points-at ${{ steps.gitversion.outputs.versionSourceSha }} | grep -m 1 ^v[0-9]*\.[0-9]*\.[0-9]* | head -1)
[[ -z "$from_tag" ]] && \
from_ref_exclusive=${{ steps.gitversion.outputs.versionSourceSha }} || \
from_ref_exclusive=$from_tag
tag=v${{ steps.versioning.outputs.version }}
if ${{ steps.versioning.outputs.is-prerelease }}; then
tag="$tag-pre-$(echo ${{ steps.versioning.outputs.release-ref }} | cut -c1-8)"
fi

[[ -z "${{ steps.gitversion.outputs.preReleaseNumber }}" ]] && \
is_prerelease=false || \
is_prerelease=true

[[ $is_prerelease == true ]] && \
tag=v${{ steps.gitversion.outputs.majorMinorPatch }}-pre-${{ steps.gitversion.outputs.shortSha }} || \
tag=v${{ steps.gitversion.outputs.majorMinorPatch }}

echo "::set-output name=is_prerelease::$is_prerelease"
echo "::set-output name=tag::$tag"
echo "::set-output name=from_ref_exclusive::$from_ref_exclusive"
- name: Create Tag
uses: actions/github-script@v3
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Convert Commit Logs to JSON
id: convert-commit-logs
uses: mikefarah/yq@v4.30.6
with:
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.release.outputs.tag }}",
sha: "${{ steps.gitversion.outputs.sha }}"
});
cmd: yq ea -o=json 'select(. != null) | [.]' "$(echo "${{ steps.versioning.outputs.commit-logs-path }}" | sed "s|^${{ github.workspace }}/||")" | tee commit_logs.json
- name: Generate Release Notes
id: release_notes
uses: ./
with:
version: ${{ steps.release.outputs.tag }}
from_ref_exclusive: ${{ steps.release.outputs.from_ref_exclusive }}
to_ref_inclusive: ${{ steps.release.outputs.tag }}
version: ${{ steps.release-tag.outputs.tag }}
last_release_ref: ${{ steps.versioning.outputs.last-release-ref }}
release_ref: ${{ steps.versioning.outputs.release-ref }}
path_to_commits: ./commit_logs.json
- name: Write Release Notes to File
run: |
echo "${{ steps.release_notes.outputs.release_notes }}" > "release_notes.txt"
- name: Package
run: zip -rj artifacts.zip dist
- name: Create Tag
uses: actions/github-script@v7
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "refs/tags/${{ steps.release-tag.outputs.tag }}",
sha: "${{ steps.versioning.outputs.release-ref }}"
});
- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.release_notes.outputs.release_notes }}
tag_name: ${{ steps.release.outputs.tag }}
prerelease: ${{ steps.release.outputs.is_prerelease }}
body_path: release_notes.txt
tag_name: ${{ steps.release-tag.outputs.tag }}
prerelease: ${{ steps.versioning.outputs.is-prerelease }}
files: artifacts.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update Latest Minor Tag
uses: EndBug/latest-tag@v1
if: steps.release.outputs.is_prerelease == 'false'
if: steps.versioning.outputs.is-prerelease == 'false'
with:
tag-name: v${{ steps.gitversion.outputs.major }}
description: ${{ steps.release.outputs.tag }}
ref: v${{ steps.versioning.outputs.major-version }}
description: ${{ steps.release-tag.outputs.tag }}
- name: Update Latest Patch Tag
uses: EndBug/latest-tag@v1
if: steps.release.outputs.is_prerelease == 'false'
if: steps.versioning.outputs.is-prerelease == 'false'
with:
tag-name: v${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}
description: ${{ steps.release.outputs.tag }}
ref: v${{ steps.versioning.outputs.major-version }}.${{ steps.versioning.outputs.minor-version }}
description: ${{ steps.release-tag.outputs.tag }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ FakesAssemblies/

# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
node_modules/*

# Visual Studio 6 build log
*.plg
Expand Down
31 changes: 10 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,16 @@ jobs:
uses: fresa/release-notes-generator@master
with:
version: v2.0.0
from_ref_exclusive: v1.0.1
to_ref_inclusive: v2.0.0
last_release_ref: v1.0.1
release_ref: v2.0.0
path_to_commits: ./commits.json
- run: echo "${{ steps.release_notes.outputs.release_notes }}"
```

### Inputs

- **version** _(required)_ - The version of the release.
Example: 2.4.0
- **from_ref_exclusive** _(required)_ - The reference where to start gather commits. The referenced commit is not included.
Examples:
- tags/v1.0.1
- v1.0.1
- heads/my-branch
- my-branch
- 431880b
- **to_ref_inclusive** _(required)_ - The reference where to stop gather commits. The referenced commit is included.
Examples:
- tags/v2.0.0
- v2.0.0
- heads/master
- master
- 531c800
- **github_token** _(optional)_ - The Github token used to query this repository.(default: `${{ github.token }}`)
### Inputs / Outputs

See [actions.yml](action.yml)

### Update from v0 -> v1

In v0 commits was automatically gathered through Github's [compare api](https://docs.github.com/en/rest/commits/commits#compare-two-commits), however this API does not fully support all the traversing options that for example `git log` exposes which caused limitations. This has been removed in v1. It now instead acts as a pure facade of [semantic-release/release-notes-generator](https://github.com/semantic-release/release-notes-generator). Use `git log $last_release_ref...$release_ref` to get the same behaviour as in v0. For an example how to fetch commit logs for releases for a [trunk based branching model](https://trunkbaseddevelopment.com/), see `Determine Release Info` in [.github/workflows/ci.yml](.github/workflows/ci.yml).
27 changes: 18 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ name: 'Semantic Release Notes Generator'
description: 'Generates release notes using semantic-release/release-notes-generator'
author: 'Fredrik Arvidsson'
inputs:
github_token:
description: 'The Github token used to query this repository'
required: true
default: ${{ github.token }}
version:
description: 'The version of the release'
required: true
from_ref_exclusive:
last_release_ref:
description: >-
The commit reference to gather commits after.
The commit reference of the last release.
The reference can be a tag, a branch or a commit sha.
Examples:
tags/v1.0.1
Expand All @@ -20,9 +16,9 @@ inputs:
my-branch
431880b
required: true
to_ref_inclusive:
release_ref:
description: >-
The last commit reference to include.
The commit reference of this release.
The reference can be a tag, a branch or a commit sha.
Examples:
tags/v2.0.0
Expand All @@ -31,11 +27,24 @@ inputs:
master
531c800
required: true
path_to_commits:
description: >-
The path to a file containing the commit messages and shas to parse as release notes.
Example:
./commit-logs.json

The content of the file should be formatted as a JSON list of commit message objects, example:
[{"hash": "62c0a92ed8c684f966391c97ef68fcd7560ff666", "message": "This is a commit message"}]
required: true
github_token:
description: 'Authorized GitHub Access Token used to fetch the release notes generator. Defaults to github.token'
required: false
default: ${{ github.token }}
outputs:
release_notes:
description: 'Semantic release notes'
runs:
using: 'node12'
using: 'node20'
pre: 'fetch_artifact.js'
main: 'dist/index.js'
branding:
Expand Down
Loading