Search code examples
packagegithub-actionsrelease

GitHub action trigger on package


I'm trying to create a github action that triggers once a new registry_package (trying to target a specific one) is uploaded to the org. I've gone through all the documentation I can find with various versions and iterations of this, but none of them work for me. So far, this is the only format I've found that doesn't just bomb out immediately (as well as trigger immediately)

name: Release New Image
on: 
  registry_package:
    action:
      - updated
    package_name: 
      - 'testpackage'

but when I ran the test package through its build paces and it uploaded to the package repo (I'm dealing with docker images so its uploading to ghcr.io/ORGNAME/testpackage:latest) it didn't trigger. The documentation here says that it needs to be in the default branch, so I tried that as well but it still isn't triggering. Has anyone gotten this trigger working that can point out what I'm doing wrong?


Solution

  • So the issue appears to be related to the fact that I'm using docker images for my stuff. From GitHub support: "At the moment, the events that can trigger a workflow are those occurring on the repository itself. When you publish a container package on GitHub Packages, you are publishing the package at the organization-level scope, so it's not actually tied to a specific repository. The registry_package trigger for now only works for packages that are repository-based such as npm and NuGet packages.

    ...

    At the moment, you would need to set up an external server that listens to the registry_package webhook at the organization level and then manually triggers a workflow run in the repository, either through the workflow_dispatch or repository_dispatch" - Paul (GitHub Support)

    No public link available for this feature request