Skip to content

KinsonDigital/PackageMonster

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

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.