Skip to content
package

GitHub Action

Package Monster

v1.0.0 Latest version

Package Monster

package

Package Monster

Checks if a NuGet package exists in the nuget.org public repository

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Package Monster

uses: KinsonDigital/[email protected]

Learn more about this action in KinsonDigital/PackageMonster

Choose a version

logo

Package Monster

GitHub Workflow Status (with event) GitHub Workflow Status (with event)

Good First GitHub Issues Discord

πŸ€·πŸΌβ€β™‚οΈ What is it? πŸ€·πŸΌβ€β™‚οΈ

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:

πŸͺ§ Example πŸͺ§

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;
        }

➑️ Action Inputs ⬅️

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

⬅️ Action Output ➑️

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.


πŸ™πŸΌ Contributing πŸ™πŸΌ

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.

πŸ”§ Maintainers πŸ”§

x-logo-dark-mode x-logo-light-mode Calvin Wilkinson (KinsonDigital GitHub Organization - Owner)

x-logo-dark-mode x-logo-light-mode Kristen Wilkinson (KinsonDigital GitHub Organization - Project Management, Documentation, Tester)


πŸš” Licensing And Governance πŸš”

Contributor Covenant MIT License

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.