mirror of
https://github.com/obi1kenobi/cargo-semver-checks-action.git
synced 2024-11-22 07:59:32 +01:00
Add manifest-path option
This commit is contained in:
parent
18ce3d76fa
commit
a754e4ed0a
2 changed files with 11 additions and 9 deletions
|
@ -15,6 +15,7 @@ Every argument is optional.
|
|||
| Input | Description | Default |
|
||||
|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|---------|
|
||||
| crate-name | The crate whose API to check for semver. If not set, all crates in the workspace are processed. | |
|
||||
| manifest-path | Path to Cargo.toml of crate or workspace to check. Has an effect only if `crate-name` is not specified. | |
|
||||
|
||||
# Scenarios
|
||||
|
||||
|
@ -22,7 +23,7 @@ Every argument is optional.
|
|||
|
||||
## Use in workspaces with more than one crate
|
||||
|
||||
By default, if workspace contains multiple crates, all of them are checked against semver violations. You can specify single crate to be checked instead using `crate-name`.
|
||||
By default, if workspace contains multiple crates, all of them are checked against semver violations. You can specify single crate to be checked instead using `crate-name` or `manifest-path`.
|
||||
|
||||
For example, this will check `my-crate`:
|
||||
```yaml
|
||||
|
|
17
action.yml
17
action.yml
|
@ -8,6 +8,10 @@ inputs:
|
|||
description: 'The crate whose API to check for semver. If not set, all crates in the workspace are processed.'
|
||||
required: false
|
||||
default: ''
|
||||
manifest-path:
|
||||
description: 'Path to Cargo.toml of crate or workspace to check. Has an effect only if crate-name is not specified.'
|
||||
required: false
|
||||
default: ''
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
@ -24,14 +28,11 @@ runs:
|
|||
# Colorize output, since GitHub Actions terminals support color.
|
||||
export CARGO_TERM_COLOR=always
|
||||
|
||||
# If crate to check is specified, pass it to cargo-semver-checks,
|
||||
# otherwise use `--workspace` option.
|
||||
if [[ "${{ inputs.crate-name }}" == '' ]]; then
|
||||
export PACKAGE_OPTION="--workspace"
|
||||
else
|
||||
export PACKAGE_OPTION="--package ${{ inputs.crate-name }}"
|
||||
fi
|
||||
export CRATE_NAME="${{ inputs.crate-name }}"
|
||||
export MANIFEST_PATH="${{ inputs.manifest-path }}"
|
||||
|
||||
export SEMVER_CHECKS_OPTIONS="${CRATE_NAME:+"--package $CRATE_NAME"} ${MANIFEST_PATH:+"--manifest-path $MANIFEST_PATH"}"
|
||||
|
||||
# Check for semver violations.
|
||||
cargo install cargo-semver-checks --locked
|
||||
cargo semver-checks check-release $PACKAGE_OPTION
|
||||
cargo semver-checks check-release $SEMVER_CHECKS_OPTIONS
|
||||
|
|
Loading…
Reference in a new issue