Skip to content

Commit

Permalink
Merge pull request #17 from embroider-build/convert-to-github-changelog
Browse files Browse the repository at this point in the history
swap everything to be github-changelog
  • Loading branch information
mansona authored Mar 12, 2024
2 parents 64f40cd + 889fadc commit 119ecad
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 2,437 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/plan-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- main
- master
pull_request:
types:
types:
- labeled

concurrency:
Expand All @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'master'
ref: 'main'
# This will only cause the `check-plan` job to have a "command" of `release`
# when the .release-plan.json file was changed on the last commit.
- id: check-release
Expand All @@ -46,35 +46,42 @@ jobs:
steps:
- uses: actions/checkout@v4
# We need to download lots of history so that
# lerna-changelog can discover what's changed since the last release
# github-changelog can discover what's changed since the last release
with:
fetch-depth: 0
ref: 'main'
- uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm install --frozen-lockfile

- name: "Generate Explanation and Prep Changelogs"
id: explanation
run: |
set -x
pnpm release-plan prepare --singlePackage=@ef4/lerna-changelog
set +e
pnpm release-plan prepare 2> >(tee -a stderr.log >&2)
echo 'text<<EOF' >> $GITHUB_OUTPUT
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
if [ $? -ne 0 ]; then
echo 'text<<EOF' >> $GITHUB_OUTPUT
cat stderr.log >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
else
echo 'text<<EOF' >> $GITHUB_OUTPUT
jq .description .release-plan.json -r >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
fi
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}

- uses: peter-evans/create-pull-request@v5
- uses: peter-evans/create-pull-request@v6
with:
commit-message: "Prepare Release using 'release-plan'"
author: "github-actions[bot] <[email protected]>"
labels: "internal"
branch: release-preview
title: Prepare Release
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# For every push to the master branch, this checks if the release-plan was
# updated and if it was it will publish stable npm packages based on the
# release plan
# release plan

name: Publish Stable

Expand All @@ -26,7 +26,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'master'
ref: 'main'
# This will only cause the `check-plan` job to have a result of `success`
# when the .release-plan.json file was changed on the last commit. This
# plus the fact that this action only runs on main will be enough of a guard
Expand All @@ -50,7 +50,7 @@ jobs:
# This creates an .npmrc that reads the NODE_AUTH_TOKEN environment variable
registry-url: 'https://registry.npmjs.org'

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: 8
- run: pnpm install --frozen-lockfile
Expand Down
20 changes: 0 additions & 20 deletions .release-it.js

This file was deleted.

32 changes: 13 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
I'm publishing and maintaining this fork based on @NathanPJF's PR [here](https://github.com/lerna/lerna-changelog/pull/134), since upstream seems to have no activity. It's available on NPM as `@ef4/lerna-changelog`. - ef4
# github-changelog

lerna-changelog
==============================================================================

[![CI](https://github.com/ef4/lerna-changelog/actions/workflows/ci.yml/badge.svg)](https://github.com/ef4/lerna-changelog/actions/workflows/ci.yml)
![npm](https://img.shields.io/npm/dw/%40ef4%2Flerna-changelog)
[![CI](https://github.com/embroider-build/github-changelog/actions/workflows/ci.yml/badge.svg)](https://github.com/embroider-build/github-changelog/actions/workflows/ci.yml)
![npm](https://img.shields.io/npm/dw/%40ef4%2Fgithub-changelog)

PR-based changelog generator with monorepo support


Usage
------------------------------------------------------------------------------
## Usage

```bash
npx lerna-changelog
npx github-changelog
```

```md
Expand All @@ -30,7 +26,7 @@ npx lerna-changelog
- [@careful-coder](https://github.com/careful-coder)
```

By default `lerna-changelog` will show all pull requests that have been merged
By default `github-changelog` will show all pull requests that have been merged
since the latest tagged commit in the repository. That is however only true for
pull requests with certain labels applied. The labels that are supported by
default are:
Expand All @@ -45,16 +41,16 @@ You can also use the `--from` and `--to` options to view a different
range of pull requests:

```bash
npx lerna-changelog --from=v1.0.0 --to=v2.0.0
npx github-changelog --from=v1.0.0 --to=v2.0.0
```

### Monorepo support

If you have a packages folder and your projects in subfolders of that folder `lerna-changelog` will detect it and include the package names in the changelog for the relevant changes.
If you have a packages folder and your projects in subfolders of that folder `github-changelog` will detect it and include the package names in the changelog for the relevant changes.

### GitHub Token

Since `lerna-changelog` interacts with the GitHub API you may run into rate
Since `github-changelog` interacts with the GitHub API you may run into rate
limiting issues which can be resolved by supplying a "personal access token":

```
Expand All @@ -66,10 +62,9 @@ for the GitHub API with the `repo` scope for private repositories or just
`public_repo` scope for public repositories.


Configuration
------------------------------------------------------------------------------
## Configuration

You can configure `lerna-changelog` in various ways. The easiest way is by
You can configure `github-changelog` in various ways. The easiest way is by
adding a `changelog` key to the `package.json` file of your project:

```json5
Expand Down Expand Up @@ -143,7 +138,6 @@ You can overwrite the default heading by including the `wildcardLabel` value in
```


License
------------------------------------------------------------------------------
## License

`lerna-changelog` is released under the [MIT License](LICENSE).
`github-changelog` is released under the [MIT License](LICENSE).
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release Process

Releases in this repo are mostly automated using [release-plan](https://github.com/embroider-build/release-plan/). Once you label all your PRs correctly (see below) you will have an automatically generated PR that updates your CHANGELOG.md file and a `.release-plan.json` that is used prepare the release once the PR is merged.
Releases in this repo are mostly automated using [release-plan](https://github.com/embroider-build/release-plan/). Once you label all your PRs correctly (see below) you will have an automatically generated PR that updates your CHANGELOG.md file and a `.release-plan.json` that is used to prepare the release once the PR is merged.

## Preparation

Expand All @@ -24,4 +24,4 @@ When reviewing merged PR's the labels to be used are:

## Release

Once the prep work is completed, the actual release is straight forward: you just need to merge the open [Plan Release](https://github.com/ef4/lerna-changelog/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR
Once the prep work is completed, the actual release is straight forward: you just need to merge the open [Plan Release](https://github.com/embroider-build/github-changelog/pulls?q=is%3Apr+is%3Aopen+%22Prepare+Release%22+in%3Atitle) PR
22 changes: 10 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"name": "@ef4/lerna-changelog",
"version": "2.2.1",
"description": "Generate a changelog for a lerna monorepo",
"name": "github-changelog",
"version": "0.0.0",
"description": "Generate a changelog from GitHub pull requests",
"keywords": [
"changelog",
"lerna"
"github"
],
"homepage": "https://github.com/ef4/lerna-changelog#readme",
"homepage": "https://github.com/embroider-build/github-changelog#readme",
"bugs": {
"url": "https://github.com/ef4/lerna-changelog/issues"
"url": "https://github.com/embroider-build/github-changelog/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ef4/lerna-changelog.git"
"url": "git+https://github.com/embroider-build/github-changelog.git"
},
"license": "MIT",
"author": "Bo Borgerson <[email protected]>",
"main": "index.js",
"bin": {
"lerna-changelog": "bin/cli.js"
"github-changelog": "bin/cli.js"
},
"scripts": {
"build": "yarn clean && tsc",
Expand Down Expand Up @@ -84,9 +84,7 @@
"jest": "28.1.3",
"jest-runner-eslint": "2.1.2",
"prettier": "2.8.8",
"release-it": "17.0.0",
"release-it-lerna-changelog": "5.0.0",
"release-plan": "^0.6.0",
"release-plan": "^0.8.0",
"rimraf": "3.0.2",
"ts-jest": "29.1.1",
"typescript": "5.0.4"
Expand All @@ -95,7 +93,7 @@
"node": "12.* || 14.* || >= 16"
},
"changelog": {
"repo": "ef4/lerna-changelog",
"repo": "embroider-build/github-changelog",
"labels": {
"breaking": ":boom: Breaking Change",
"enhancement": ":rocket: Enhancement",
Expand Down
Loading

0 comments on commit 119ecad

Please sign in to comment.