64 lines
2.3 KiB
YAML
64 lines
2.3 KiB
YAML
name: npm-diff
|
|
description: "Compare two versions of an NPM package using npm diff."
|
|
inputs:
|
|
name:
|
|
description: "Name of the package to diff."
|
|
required: true
|
|
lhsVersion:
|
|
description: "Left-hand side version (older version) to compare. If not specified, uses the latest version."
|
|
required: false
|
|
default: ""
|
|
rhsVersion:
|
|
description: "Right-hand side version (newer version) to compare. If not specified, compares against the working directory."
|
|
required: false
|
|
default: ""
|
|
workingDirectory:
|
|
description: "Working directory containing package.json (for comparing local changes)."
|
|
required: false
|
|
default: "."
|
|
nodeVersion:
|
|
description: "Node.js version to use."
|
|
required: false
|
|
default: "20"
|
|
registry:
|
|
description: "NPM registry URL."
|
|
required: false
|
|
default: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/nuget/index.json
|
|
authToken:
|
|
description: "Authentication token for the registry."
|
|
required: true
|
|
default: "{{ github.token }}"
|
|
diffOptions:
|
|
description: "Additional options to pass to npm diff (e.g., '--diff-ignore-whitespace')."
|
|
required: false
|
|
default: ""
|
|
outputFile:
|
|
description: "File path to save diff output (optional). If not specified, outputs to console only."
|
|
required: false
|
|
default: ""
|
|
failOnDifferences:
|
|
description: "Whether to fail the action if differences are found."
|
|
required: false
|
|
default: "true"
|
|
outputs:
|
|
hasDifferences:
|
|
description: "Whether differences were found between the versions."
|
|
value: ${{ steps.diff.outputs.hasDifferences }}
|
|
diffOutput:
|
|
description: "The diff output (truncated if too large)."
|
|
value: ${{ steps.diff.outputs.diffOutput }}
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: "Setup Node.js"
|
|
uses: https://github.com/actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ inputs.nodeVersion }}
|
|
registry-url: ${{ inputs.registry }}
|
|
- name: "Run npm diff"
|
|
id: diff
|
|
env:
|
|
NODE_AUTH_TOKEN: ${{ inputs.authToken }}
|
|
run: bash ${{ github.action_path }}/npm_diff.sh "${{ inputs.name }}" "${{ inputs.lhsVersion }}" "${{ inputs.rhsVersion }}" "${{ inputs.workingDirectory }}" "${{ inputs.registry }}" "${{ inputs.diffOptions }}" "${{ inputs.outputFile }}" "${{ inputs.failOnDifferences }}"
|
|
shell: bash
|