Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Added ability to use package.json in different dir #7

Merged
merged 2 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,17 @@ jobs:
The above workflow will create a release that looks like:
![Release](release.png)

If your `package.json` isn't available in root, you can pass the directory of the `package.json`:

```yaml
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: Changelog
env:
REPO: ${{ github.repository }}
with:
package-dir: 'root/to/my/package.json'
```

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)

5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ author: 'Scott Brenner'
outputs:
changelog:
description: 'Generate changelog'
inputs:
package-dir:
description: 'The path for the package.json if it's not in root'
required: false
default: 'package.json'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
4 changes: 4 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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

if [ "$1" ] && [ "$1" != "package.json" ]; then
cp "$1" package.json
fi

tag=$(git tag --sort version:refname | tail -n 2 | head -n 1)
changelog=$(generate-changelog -t "$tag" --file -)

Expand Down