Skip to content

Commit 6788199

Browse files
authored
break(entrypoint): Changed system to use titles (#1)
Changed system to not use the `package.json` but instead just use the git formula: `git log --oneline --no-decorate $tag..HEAD`. This will now list all the commits between the new tag and the latest tag in a nicely formatted list using the pattern: `- HASH - Title`
1 parent 4f38e6d commit 6788199

File tree

5 files changed

+15
-35
lines changed

5 files changed

+15
-35
lines changed

Dockerfile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM alpine:3
22

3-
RUN apk --no-cache add git nodejs-npm
4-
RUN npm install -g generate-changelog
3+
RUN apk --no-cache add git
54

65
COPY LICENSE README.md /
76

README.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# generate-changelog-action
22

3-
GitHub Action for [lob/generate-changelog](https://github.com/lob/generate-changelog/). Intended to be used with [actions/create-release](https://github.com/actions/create-release).
3+
GitHub Action for generating a changelog of all the git commits between the new tag and the latest tags.
44

5-
**Note:** [Your repository must contain a `package.json` file.](https://github.com/lob/generate-changelog/issues/38#issuecomment-362726723)
6-
7-
Created during the GitHub Actions Hackathon 2020 and [selected as one of the winning projects!](https://docs.google.com/spreadsheets/d/1YL6mjJXGt3-75GejQCubsOvWwtYcGaqbJA7msnsh7Tg/edit#gid=0&range=A100:C100)
5+
Based on [ScottBrenner/generate-changelog-action](https://github.com/ScottBrenner/generate-changelog-action).
6+
Intended to be used with [actions/create-release](https://github.com/actions/create-release).
87

98
## Example workflow - create a release
109
Extends [actions/create-release: Example workflow - create a release](https://github.com/actions/create-release#example-workflow---create-a-release) to generate changelog from git commits and use it as the body for the GitHub release.
@@ -49,17 +48,5 @@ jobs:
4948
The above workflow will create a release that looks like:
5049
![Release](release.png)
5150
52-
If your `package.json` isn't available in root, you can pass the directory of the `package.json`:
53-
54-
```yaml
55-
- name: Changelog
56-
uses: scottbrenner/generate-changelog-action@master
57-
id: Changelog
58-
env:
59-
REPO: ${{ github.repository }}
60-
with:
61-
package-dir: 'root/to/my/package.json'
62-
```
63-
64-
For more information, see [actions/create-release: Usage](https://github.com/actions/create-release#usage) and [lob/generate-changelog: Usage](https://github.com/lob/generate-changelog#usage)
51+
For more information, see [actions/create-release: Usage](https://github.com/actions/create-release#usage).
6552

action.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
name: 'generate-changelog-action'
2-
description: 'GitHub Action for lob/generate-changelog'
3-
author: 'Scott Brenner'
2+
description: 'GitHub Action for generating a changelog of all commits in a release'
3+
author: 'Javier Bullrich'
44
outputs:
55
changelog:
66
description: 'Generate changelog'
7-
inputs:
8-
package-dir:
9-
description: 'The path for the package.json if it is not in root'
10-
required: false
11-
default: 'package.json'
127
runs:
138
using: 'docker'
149
image: 'Dockerfile'
15-
args:
16-
- ${{ inputs.package-dir }}
1710
branding:
1811
icon: 'edit'
1912
color: 'gray-dark'

entrypoint.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
git clone --quiet https://github.com/$REPO &> /dev/null
44

5-
if [ "$1" ] && [ "$1" != "package.json" ]; then
6-
cp "$1" package.json
7-
fi
8-
95
tag=$(git tag --sort version:refname | tail -n 2 | head -n 1)
10-
changelog=$(generate-changelog -t "$tag" --file -)
6+
7+
if [ "$tag" ]; then
8+
changelog=$(git log --oneline --no-decorate $tag..HEAD)
9+
else
10+
changelog=$(git log --oneline --no-decorate)
11+
fi
1112

1213
echo $changelog
1314

1415
changelog="${changelog//'%'/'%25'}"
15-
changelog="${changelog//$'\n'/'%0A'}"
16-
changelog="${changelog//$'\r'/'%0D'}"
16+
changelog="${changelog//$'\n'/'%0A' - }"
17+
changelog=" - ${changelog//$'\r'/'%0D'}"
1718

1819
echo "::set-output name=changelog::$changelog"

release.png

7.07 KB
Loading

0 commit comments

Comments
 (0)