Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hugorcd/version-diff-action
GitHub Action to detect version changes in package.json files
https://github.com/hugorcd/version-diff-action
actions github-actions version-control versioning
Last synced: 1 day ago
JSON representation
GitHub Action to detect version changes in package.json files
- Host: GitHub
- URL: https://github.com/hugorcd/version-diff-action
- Owner: HugoRCD
- License: apache-2.0
- Created: 2024-11-10T21:46:57.000Z (7 days ago)
- Default Branch: main
- Last Pushed: 2024-11-10T22:51:28.000Z (7 days ago)
- Last Synced: 2024-11-10T23:25:28.549Z (7 days ago)
- Topics: actions, github-actions, version-control, versioning
- Language: TypeScript
- Homepage:
- Size: 356 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# package-version-checker-action
> GitHub Action to detect version changes in package.json files
## Usage
Add this to your GitHub workflow:
```yaml
name: Check Version
on:
push:
paths:
- '**/package.json'jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2- name: Check package.json version
uses: hugorcd/version-diff-action@v1
id: version_check
with:
path: './'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}- name: Handle version change
if: steps.version_check.outputs.has_changed == 'true'
run: |
echo "Version changed from ${{ steps.version_check.outputs.old_version }} to ${{ steps.version_check.outputs.new_version }}"
```## Inputs
| Name | Description | Required | Default |
| --- | --- | --- | --- |
| `path` | Path to package.json file | `false` | `./` |## Outputs
| Name | Description | Example |
| --- | --- | --- |
| `has_changed` | True if version has changed | `true` |
| `old_version` | Previous version | `1.0.0` |
| `new_version` | Current version | `1.0.1` |## Development
To run tests:
```bash
bun test
```To run tests in watch mode:
```bash
bun test --watch
```## License
[Apache-2.0](LICENSE)