An open API service indexing awesome lists of open source software.

https://github.com/cssnr/package-changelog-action

Package Changelog Action
https://github.com/cssnr/package-changelog-action

actions

Last synced: 23 days ago
JSON representation

Package Changelog Action

Awesome Lists containing this project

README

          

[![GitHub Tag Major](https://img.shields.io/github/v/tag/cssnr/package-changelog-action?sort=semver&filter=!v*.*&logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/package-changelog-action/tags)
[![GitHub Tag Minor](https://img.shields.io/github/v/tag/cssnr/package-changelog-action?sort=semver&filter=!v*.*.*&logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/package-changelog-action/releases)
[![GitHub Release Version](https://img.shields.io/github/v/release/cssnr/package-changelog-action?logo=git&logoColor=white&labelColor=585858&label=%20)](https://github.com/cssnr/package-changelog-action/releases/latest)
[![GitHub Dist Size](https://img.shields.io/github/size/cssnr/package-changelog-action/dist%2Findex.js?logo=bookstack&logoColor=white&label=dist%20size)](https://github.com/cssnr/package-changelog-action/blob/master/src/index.js)
[![Action Run Using](https://img.shields.io/badge/dynamic/yaml?url=https%3A%2F%2Fraw.githubusercontent.com%2Fcssnr%2Fpackage-changelog-action%2Frefs%2Fheads%2Fmaster%2Faction.yml&query=%24.runs.using&logo=githubactions&logoColor=white&label=runs)](https://github.com/cssnr/package-changelog-action/blob/master/action.yml)
[![Workflow Release](https://img.shields.io/github/actions/workflow/status/cssnr/package-changelog-action/release.yaml?logo=cachet&label=release)](https://github.com/cssnr/package-changelog-action/actions/workflows/release.yaml)
[![Workflow Lint](https://img.shields.io/github/actions/workflow/status/cssnr/package-changelog-action/lint.yaml?logo=cachet&label=lint)](https://github.com/cssnr/package-changelog-action/actions/workflows/lint.yaml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=cssnr_package-changelog-action&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=cssnr_package-changelog-action)
[![GitHub Last Commit](https://img.shields.io/github/last-commit/cssnr/package-changelog-action?logo=github&label=updated)](https://github.com/cssnr/package-changelog-action/pulse)
[![Codeberg Last Commit](https://img.shields.io/gitea/last-commit/cssnr/package-changelog-action/master?gitea_url=https%3A%2F%2Fcodeberg.org%2F&logo=codeberg&logoColor=white&label=updated)](https://codeberg.org/cssnr/package-changelog-action)
[![GitHub Repo Size](https://img.shields.io/github/repo-size/cssnr/package-changelog-action?logo=bookstack&logoColor=white&label=repo%20size)](https://github.com/cssnr/package-changelog-action?tab=readme-ov-file#readme)
[![GitHub Top Language](https://img.shields.io/github/languages/top/cssnr/package-changelog-action?logo=htmx)](https://github.com/cssnr/package-changelog-action?tab=readme-ov-file#readme)
[![GitHub Contributors](https://img.shields.io/github/contributors-anon/cssnr/package-changelog-action?logo=github)](https://github.com/cssnr/package-changelog-action/graphs/contributors)
[![GitHub Forks](https://img.shields.io/github/forks/cssnr/package-changelog-action?style=flat&logo=github)](https://github.com/cssnr/package-changelog-action/forks)
[![GitHub Discussions](https://img.shields.io/github/discussions/cssnr/package-changelog-action?logo=github)](https://github.com/cssnr/package-changelog-action/discussions)
[![GitHub Repo Stars](https://img.shields.io/github/stars/cssnr/package-changelog-action?style=flat&logo=github)](https://github.com/cssnr/package-changelog-action/stargazers)
[![GitHub Org Stars](https://img.shields.io/github/stars/cssnr?style=flat&logo=github&label=org%20stars)](https://cssnr.github.io/)
[![Discord](https://img.shields.io/discord/899171661457293343?logo=discord&logoColor=white&label=discord&color=7289da)](https://discord.gg/wXy6m2X8wY)
[![Ko-fi](https://img.shields.io/badge/Ko--fi-72a5f2?logo=kofi&label=support)](https://ko-fi.com/cssnr)

# Package Changelog Action

- [Inputs](#Inputs)
- [Permissions](#Permissions)
- [Changelog Options](#Changelog-Options)
- [Changelog Examples](#Changelog-Examples)
- [Outputs](#Outputs)
- [Examples](#Examples)
- [Tags](#Tags)
- [Features](#Features)
- [Planned](#Planned)
- [Support](#Support)
- [Contributing](#Contributing)

Action to Generate Package Changelog. View some [Changelog Examples](#Changelog-Examples).

On a release, this action will parse the differences in the provided `package-lock.json` file
between the current and previous release and update the release notes with a table of changes.

On a prerelease it compares with the previous release, on a non-prerelease release,
it compares with the previous non-prerelease.

Packages get sorted into the following categories and columns:

| Name | ❔ | Operation | Before | After |
| :---------- | :-: | :--------- | :------- | :------ |
| @added | 🆕 | Added | | current |
| @upgrade | ✅ | Upgraded | previous | current |
| @downgraded | ⚠️ | Downgraded | previous | current |
| @removed | ⛔ | Removed | previous | |
| @unknown | ❓ | Unknown | previous | current |
| @unchanged | 🔘 | Unchanged | previous | current |

> [!TIP]
> Both Columns and Section Order and Visibility can be Customized!
> See [Changelog Options](#Changelog-Options) and [Changelog Examples](#Changelog-Examples) for more...

## Inputs

| Input | Req. | Default Value | Input Description |
| :------- | :--: | :--------------------------- | :-------------------------------------------------- |
| path | - | `package-lock.json` | Location of Lock File |
| update | - | `true` | Update Release Notes [⤵️](#Changelog-Examples) |
| heading | - | `### Package Changes` | Release Notes Heading [⤵️](#Changelog-Options) |
| toggle | - | `Click Here to View Changes` | Toggle Text for Summary [⤵️](#Changelog-Options) |
| open | - | `false` | Summary Open by Default [⤵️](#Changelog-Options) |
| empty | - | `false` | Add Summary on No Changes [⤵️](#Changelog-Options) |
| columns | - | `n,i,t,b,a` | Customize Table Columns [⤵️](#Changelog-Options) |
| sections | - | `a,u,d,r,k` | Customize Package Sections [⤵️](#Changelog-Options) |
| max | - | `30` | Max Releases to Process |
| summary | - | `true` | Add Workflow Job Summary |
| token | - | `github.token` | For use with a PAT |

You can add this to your release workflow with no inputs.

```yaml
- name: 'Package Changelog Action'
continue-on-error: true
uses: cssnr/package-changelog-action@v2
```

Note: `continue-on-error: true` is set here so your release workflow won't fail if processing the changelog fails.

See the [Changelog Options](#Changelog-Options) to customize the results.

### Permissions

This action requires the following permissions to update release notes:

```yaml
permissions:
contents: write
```

Permissions documentation for [Workflows](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token) and [Actions](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication).

### Changelog Options

**update:** Set this to `false` if you only want to use the [Outputs](#Outputs).

**heading:** You can customize the `heading` or set to an empty string to remove it.

**toggle:** The `toggle` must be set to a non-empty string if changing this input.

**open:** Set summary to be open by default (note the first example below is open).

**empty:** Set this to `true` to update release notes when no changes are detected.

**columns:** Customize column visibility and order.
This must be a perfectly formatted CSV with any combination of these keys:

Default value: `n,i,t,b,a`

| Key | Column | Column Description |
| :-: | :----------- | :---------------------- |
| `n` | Package Name | Name of the package |
| `i` | ❔ | Icon of the outcome |
| `t` | Outcome | Text of the outcome |
| `b` | Before | Version before change |
| `a` | After | Version after change |

**sections:** Customize section visibility and order.
This must be a perfectly formatted CSV with any combination of these keys:

Default value: `a,u,d,r,k`

| Key | Section | Section Description |
| :-: | :--------- | :-------------------------- |
| `a` | Added | Newly added package |
| `u` | Upgraded | Updated package version |
| `d` | Downgraded | Downgraded package version |
| `r` | Removed | Removed package |
| `k` | Unknown | Invalid semantic version |
| `n` | Unchanged | Package version not changed |

Note: Enabling Unchanged `n` packages can produce a very long list.

View the Column and Section Maps

```javascript
const maps = {
col: {
n: { align: 'l', col: 'Package Name' },
i: { align: 'c', col: '❔' },
t: { align: 'c', col: 'Operation' },
b: { align: 'l', col: 'Before' },
a: { align: 'l', col: 'After' },
},
sec: {
a: { icon: '🆕', text: 'Added', key: 'added' },
u: { icon: '✅', text: 'Upgraded', key: 'upgraded' },
d: { icon: '⚠️', text: 'Downgraded', key: 'downgraded' },
r: { icon: '⛔', text: 'Removed', key: 'removed' },
k: { icon: '❓', text: 'Unknown', key: 'unknown' },
n: { icon: '🔘', text: 'Unchanged', key: 'unchanged' },
},
}
```

### Changelog Examples

💡 _Click on an example heading to expand or collapse the example._

_Note: Examples are generated with an empty header and default values._

🔷 Default Example

---

Click Here to View Changes

Changes for: [package-lock.json](package-lock.json)

| Package Name | ❔ | Before | After |
| :------------------------------------------- | :-: | :----- | :----- |
| @eslint/config-helpers | 🆕 | | 0.1.0 |
| @eslint-community/eslint-utils | ✅ | 4.4.1 | 4.5.1 |
| @eslint/core | ✅ | 0.11.0 | 0.12.0 |
| @eslint/eslintrc | ✅ | 3.2.0 | 3.3.0 |
| @eslint/js | ✅ | 9.20.0 | 9.22.0 |
| @eslint/plugin-kit | ✅ | 0.2.5 | 0.2.7 |
| @humanwhocodes/retry | ✅ | 0.4.1 | 0.4.2 |
| @octokit/endpoint | ✅ | 9.0.5 | 9.0.6 |
| @octokit/graphql | ✅ | 7.1.0 | 7.1.1 |
| @octokit/plugin-paginate-rest | ✅ | 9.2.1 | 9.2.2 |
| @octokit/request | ✅ | 8.4.0 | 8.4.1 |
| @octokit/request-error | ✅ | 5.1.0 | 5.1.1 |
| acorn | ✅ | 8.14.0 | 8.14.1 |
| eslint | ✅ | 9.20.1 | 9.22.0 |
| eslint-scope | ✅ | 8.2.0 | 8.3.0 |
| flatted | ✅ | 3.3.2 | 3.3.3 |
| prettier | ✅ | 3.5.0 | 3.5.3 |
| @eslint/plugin-kit/node_modules/@eslint/core | ⛔ | 0.10.0 | |

---

🔷 Example with No Changes

---

No changes detected in: [package-lock.json](package-lock.json)

---

More Changelog Examples Coming Soon...

For more options, see the [Changelog Options](#Changelog-Options).

## Outputs

| Output | Output Description |
| :------- | :---------------------- |
| json | Chnages JSON Object |
| markdown | Changes Markdown Table |

This outputs the changes `json` object and the `markdown` table.

```yaml
- name: 'Package Changelog Action'
id: changelog
uses: cssnr/package-changelog-action@v2

- name: 'Echo Output'
env:
JSON: ${{ steps.changelog.outputs.json }}
MARKDOWN: ${{ steps.changelog.outputs.markdown }}
run: |
echo "json: ${JSON}"
echo "markdown: ${MARKDOWN}"
```

Note: due to the way `${{}}` expressions are evaluated, multi-line output gets executed in a run block.

JSON Schema

```json
{
"added": [{ "name": "", "after": "" }],
"downgraded": [{ "name": "", "before": "", "after": "" }],
"removed": [{ "name": "", "before": "" }],
"unchanged": [{ "name": "", "before": "", "after": "" }],
"unknown": [{ "name": "", "before": "", "after": "" }],
"upgraded": [{ "name": "", "before": "", "after": "" }]
}
```

More Output Examples Coming Soon...

## Examples

💡 _Click on an example heading to expand or collapse the example._

Custom Heading

```yaml
- name: 'Package Changelog Action'
uses: cssnr/package-changelog-action@v2
with:
heading: '**NPM Changelog**'
```

Custom Column Order

```yaml
- name: 'Package Changelog Action'
uses: cssnr/package-changelog-action@v2
with:
columns: 'n,t,b,a'
```

This removes the icon column.

Custom Section Order

```yaml
- name: 'Package Changelog Action'
uses: cssnr/package-changelog-action@v2
with:
sections: 'u,a,d,r,k'
```

This changes the section order to put Updated before Added.

Use Outputs Only

```yaml
- name: 'Package Changelog Action'
id: changelog
uses: cssnr/package-changelog-action@v2
with:
update: false

- name: 'Echo Output'
env:
JSON: ${{ steps.changelog.outputs.json }}
MARKDOWN: ${{ steps.changelog.outputs.markdown }}
run: |
echo "json: ${JSON}"
echo "markdown: ${MARKDOWN}"
```

Full Workflow Example

```yaml
name: 'Release'

on:
release:
types: [published]

jobs:
release:
name: 'Release'
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: write

steps:
- name: 'Package Changelog Action'
uses: cssnr/package-changelog-action@v2
continue-on-error: true
```

For more examples, you can check out other projects using this action:
https://github.com/cssnr/package-changelog-action/network/dependents

## Tags

The following rolling [tags](https://github.com/cssnr/package-changelog-action/tags) are maintained.

| Version Tag | Rolling | Bugs | Feat. | Name | Target | Example |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-----: | :--: | :---: | :-------: | :------: | :------- |
| [![GitHub Tag Major](https://img.shields.io/github/v/tag/cssnr/package-changelog-action?sort=semver&filter=!v*.*&style=for-the-badge&label=%20&color=44cc10)](https://github.com/cssnr/package-changelog-action/releases/latest) | ✅ | ✅ | ✅ | **Major** | `vN.x.x` | `vN` |
| [![GitHub Tag Minor](https://img.shields.io/github/v/tag/cssnr/package-changelog-action?sort=semver&filter=!v*.*.*&style=for-the-badge&label=%20&color=blue)](https://github.com/cssnr/package-changelog-action/releases/latest) | ✅ | ✅ | ❌ | **Minor** | `vN.N.x` | `vN.N` |
| [![GitHub Release](https://img.shields.io/github/v/release/cssnr/package-changelog-action?style=for-the-badge&label=%20&color=red)](https://github.com/cssnr/package-changelog-action/releases/latest) | ❌ | ❌ | ❌ | **Micro** | `vN.N.N` | `vN.N.N` |

You can view the release notes for each version on the [releases](https://github.com/cssnr/package-changelog-action/releases) page.

The **Major** tag is recommended. It is the most up-to-date and always backwards compatible.
Breaking changes would result in a **Major** version bump. At a minimum you should use a **Minor** tag.

## Features

- Automatically parse differences between package-lock.json changes between releases.
- Sorts into sections: Added, Upgraded, Downgraded, Removed, Unknown, Unchanged.
- Option to customize sections visibility and sections order.
- Option to customize columns visibility and columns order.
- Option to display results expanded or collapsed.
- Outputs changes in JSON and markdown.

### Planned

- Work on Pull Requests
- Work on Workflow Dispatch
- Custom Column Alignment
- Custom Column Titles
- Custom Section Icons
- Custom Section Text

Want to show outdated packages on a pull request? Check out: [cssnr/npm-outdated-action](https://github.com/cssnr/npm-outdated-action?tab=readme-ov-file#readme)
Want to automatically updated tags on release? Check out: [cssnr/update-version-tags-action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)

If you would like to see a new feature, please [submit a feature request](https://github.com/cssnr/package-changelog-action/discussions/categories/feature-requests).

# Support

For general help or to request a feature, see:

- Q&A Discussion: https://github.com/cssnr/package-changelog-action/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/package-changelog-action/discussions/categories/feature-requests

If you are experiencing an issue/bug or getting unexpected results, you can:

- Report an Issue: https://github.com/cssnr/package-changelog-action/issues
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
- Provide General Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=Package%20Changelog%20Action)

For more information, see the CSSNR [SUPPORT.md](https://github.com/cssnr/.github/blob/master/.github/SUPPORT.md#support).

# Contributing

If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file).

Please consider making a donation to support the development of this project
and [additional](https://cssnr.com/) open source projects.

[![Ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/cssnr)

[![Actions Tools](https://raw.githubusercontent.com/smashedr/repo-images/refs/heads/master/actions/actions-tools.png)](https://actions-tools.cssnr.com/)

Additionally, you can support other [GitHub Actions](https://actions.cssnr.com/) I have published:

- [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
- [Portainer Stack Deploy Action](https://github.com/cssnr/portainer-stack-deploy-action?tab=readme-ov-file#readme)
- [Docker Context Action](https://github.com/cssnr/docker-context-action?tab=readme-ov-file#readme)
- [Actions Up Action](https://github.com/cssnr/actions-up-action?tab=readme-ov-file#readme)
- [Zensical Action](https://github.com/cssnr/zensical-action?tab=readme-ov-file#readme)
- [VirusTotal Action](https://github.com/cssnr/virustotal-action?tab=readme-ov-file#readme)
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action?tab=readme-ov-file#readme)
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
- [Docker Tags Action](https://github.com/cssnr/docker-tags-action?tab=readme-ov-file#readme)
- [TOML Action](https://github.com/cssnr/toml-action?tab=readme-ov-file#readme)
- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action?tab=readme-ov-file#readme)
- [JSON Key Value Check Action](https://github.com/cssnr/json-key-value-check-action?tab=readme-ov-file#readme)
- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action?tab=readme-ov-file#readme)
- [Cloudflare Purge Cache Action](https://github.com/cssnr/cloudflare-purge-cache-action?tab=readme-ov-file#readme)
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action?tab=readme-ov-file#readme)
- [Package Changelog Action](https://github.com/cssnr/package-changelog-action?tab=readme-ov-file#readme)
- [NPM Outdated Check Action](https://github.com/cssnr/npm-outdated-action?tab=readme-ov-file#readme)
- [Label Creator Action](https://github.com/cssnr/label-creator-action?tab=readme-ov-file#readme)
- [Algolia Crawler Action](https://github.com/cssnr/algolia-crawler-action?tab=readme-ov-file#readme)
- [Upload Release Action](https://github.com/cssnr/upload-release-action?tab=readme-ov-file#readme)
- [Check Build Action](https://github.com/cssnr/check-build-action?tab=readme-ov-file#readme)
- [Web Request Action](https://github.com/cssnr/web-request-action?tab=readme-ov-file#readme)
- [Get Commit Action](https://github.com/cssnr/get-commit-action?tab=readme-ov-file#readme)

❔ Unpublished Actions

These actions are not published on the Marketplace, but may be useful.

- [cssnr/create-files-action](https://github.com/cssnr/create-files-action?tab=readme-ov-file#readme) - Create various files from templates.
- [cssnr/draft-release-action](https://github.com/cssnr/draft-release-action?tab=readme-ov-file#readme) - Keep a draft release ready to publish.
- [cssnr/env-json-action](https://github.com/cssnr/env-json-action?tab=readme-ov-file#readme) - Convert env file to json or vice versa.
- [cssnr/push-artifacts-action](https://github.com/cssnr/push-artifacts-action?tab=readme-ov-file#readme) - Sync files to a remote host with rsync.
- [smashedr/update-release-notes-action](https://github.com/smashedr/update-release-notes-action?tab=readme-ov-file#readme) - Update release notes.
- [smashedr/combine-release-notes-action](https://github.com/smashedr/combine-release-notes-action?tab=readme-ov-file#readme) - Combine release notes.

---

📝 Template Actions

These are basic action templates that I use for creating new actions.

- [javascript-action](https://github.com/smashedr/javascript-action?tab=readme-ov-file#readme) - JavaScript
- [typescript-action](https://github.com/smashedr/typescript-action?tab=readme-ov-file#readme) - TypeScript
- [py-test-action](https://github.com/smashedr/py-test-action?tab=readme-ov-file#readme) - Dockerfile Python
- [test-action-uv](https://github.com/smashedr/test-action-uv?tab=readme-ov-file#readme) - Dockerfile Python UV
- [docker-test-action](https://github.com/smashedr/docker-test-action?tab=readme-ov-file#readme) - Docker Image Python

Note: The `docker-test-action` builds, runs and pushes images to [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).

---

For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/)