Skip to content

NuGet Package Availability Checker

Actions
GitHub Action automates NuGet package availability checks, ensuring packages exist and are indexed on nuget.org
v1.5.3
Latest
Star (0)

nuget-package-check-action

Release CI CodeQL codecov

  • Automates NuGet package availability checks, ensuring packages exist and are indexed on nuget.org.
  • Supports multiple verification attempts and can suspend CI/CD workflows until the package is published.
  • Simple and fast. Works natively without Dockerfile and no need for dotnet, and other dependencies.

How to use

✅ To quickly check if the package exists and is available on NuGet, please add the following job:

- name: Check Available NuGet Package
  uses: BMTLab/nuget-package-check-action@v1.5.3
  with:
    package: Your.AwesomePackage
    version: 1.3.505

✅ If your workflow publishes a package and further work requires that the package is already available and indexed, please set a reasonable number of retries:

Tip

The retry interval is 30 seconds, so 10 retries are usually enough time between publishing and when the package is indexed and available.

- name: Check Available NuGet Package
  id: check-nuget-package
  uses: BMTLab/nuget-package-check-action@v1.5.3
  with:
    package: Your.AwesomePackage # 👈🏻 Any valid NuGet Package name, case-insensitive
    version: 1.3.505.01-beta     # 👈🏻 Version without any prefix ('v' e.g), case-insensitive
    # 1, 1.0, 1.0.0 and 1.0.0.0 are suitable, 
    # it is also possible to specify the suffix via '-'

    attempts: 10 # The value must be > 0
  continue-on-error: true

❌ Input values will be validated, you will get an error if the format is incorrect.

Outputs

❌ The job will terminate with an error if no package is found, please add continue-on-error: true to just get the checking result and not fail your workflow.

The action sets an output variable called indexed, which can be used in the following step by using:

${{ steps.check-nuget-package.outputs.indexed}}, that can only have 'true' or 'false' values.

Example output usage

- name: Push NuGet for ${{ env.PACKAGE_NAME }}
  if: ${{ steps.check-nuget-package.outputs.indexed != 'true' }}
  run: dotnet nuget push ./*.nupkg --source ${{ env.NUGET_URL }} --api-key ${{ secrets.NUGET_API_KEY }}

Action output log

⮞ Run BMTLab/nuget-package-check-action@v1.5.3
Starting NuGet Package Index Checker...
Package Name: BMTLab.OneOf.Reduced
Package Version: 4.1.0424
Attempt 1 of 12: Package not indexed yet. Retrying in 30 seconds...
Attempt 2 of 12: Package not indexed yet. Retrying in 30 seconds...
Package BMTLab.OneOf.Reduced version 4.1.0424 is indexed on nuget.org.
Package indexed status: true

Compatibility

Ubuntu Windows MacOS

Important

When you're using self-hosted runners, please make sure you have Node.js v20 installed!


If you just want a script that does a package check, check out my gist with a bash script here: check-nuget-pkg-indexed.sh

Please feel free to fork this, contribute or let me know if you find a bug. Also, any ideas for improvement would be appreciated 😇

NuGet Package Availability Checker is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

GitHub Action automates NuGet package availability checks, ensuring packages exist and are indexed on nuget.org
v1.5.3
Latest

NuGet Package Availability Checker is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.