GitHub Action
Package Monster
This GitHub action checks whether or not a NuGet package with a particular name and version exists in the public NuGet gallery package repository nuget.org.
Note This GitHub action is built using C#/NET and runs in a docker container. If the job step for running this action is contained in a job that runs on Windows, you will need to move the step to a job that runs on Ubuntu. You can split up your jobs to fulfill
runs-on
requirements of the GitHub action. This can be accomplished by moving the step into its own job. You can then route the action step outputs to the job outputs and use them throughout the rest of your workflow. For more information, refer to the Github documentation links below: For more info on step and job outputs, refer to the GitHub documentation links below:
name: Package Monster Action Sample
on:
workflow_dispatch:
jobs:
test_action:
name: Test Package Monster GitHub Action
runs-on: ubuntu-latest ππΌ # Required (Refer to the note above)
steps:
- uses: actions/checkout@v3
- name: Check If Nuget Package Exists
id: nuget-exists
uses: JohnDoe/[email protected]
with:
package-name: MyPackage ππ» # Required input
version: 1.2.3 ππ» # Required input
fail-when-not-found: true ππ» # Optional input
- name: Print Output Result #PowerShell Core
shell: pwsh ππΌ # Must be explicit with the shell to use PowerShell on Ubuntu
run: |
# Output name for the Package Monster GitHub action ππΌ
# _____|_____
# | |
$nugetExists = "${{ steps.nuget-exists.outputs.nuget-exists }}";
if ($nugetExists -eq "true") {
Write-Host "::notice::The NuGet package exists!!";
} else {
Write-Host "::error::The NuGet package does not exist!!";
exit 1;
}
Input Name | Description | Required | Default Value |
---|---|---|---|
package-name |
The name of the NuGet package. | yes | N/A |
version |
The version of the package. | yes | N/A |
fail-when-not-found |
Will fail the job if the NuGet package of a specific version is not found. | no | false |
The name of the output is nuget-exists
and it returns a boolean
of true
or false
.
Refer to the Example above for how to use the output of the action.
Interested in contributing? If so, click here to learn how to contribute your time or here if you are interested in contributing your funds via one-time or recurring donation.
Calvin Wilkinson (KinsonDigital GitHub Organization - Owner)
Kristen Wilkinson (KinsonDigital GitHub Organization - Project Management, Documentation, Tester)
This software is distributed under the very permissive MIT license and all dependencies are distributed under MIT-compatible licenses. This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community.