npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dpx

v3.1.1

Published

Send repository dispatch events to a GitHub repository

Downloads

1,033

Readme

dpx

This is a utility for sending repository dispatch and workflow dispatch events to GitHub repositories.

Use

This tool attempts to allow you to dispatch events quickly with as little typing as possible, provided you've got your environment set up for it:

  • You can avoid passing a GitHub token manually by setting a GITHUB_TOKEN environment variable.
  • You can avoid passing a GitHub repository by having a git remote called "origin" in your .git/config that points to a GitHub repository
  • By default, dpx attempts to parse values as JSON (pass --raw to avoid this)
  • The presence of the -w/--workflow flag indicates dpx should send a workflow dispatch event instead of a repository dispatch event.
# Send a "test" repo dispatch event.
> npx dpx test

# Send a "deploy" repo dispatch event with a payload `{"branch": "main"}`.
> npx dpx deploy branch=main

# Send a "db-migrate" repo dispatch event with a payload `{"direction": "up", "count": 1}`
> npx dpx db-migrate direction=up count=1

# Send a "db-migrate" repo dispatch event with a payload `{"direction": "up", "count": "1"}`
> npx dpx --raw db-migrate direction=up count=1

# Trigger the "test.yml" workflow on the "dev" branch with the payload `{"fast": "true"}`
> npx dpx -w test.yml -f dev fast=true

Flags & Arguments

  • -r/--repo A name-with-owner string (as in jclem/dpx) pointing to the repository for the dispatch to be sent to
  • -t/--token A GitHub personal access token with repo scope
  • -v/--version Display the version of dpx
  • --raw Do not parse values in key=value pairs
  • -d/--dry-run Log event type and payload, but don't send a request
  • -h/--help Display the help message
  • -w/--workflow The workflow to use for a workflow dispatch event
  • -f/--ref The ref to run from for a workflow dispatch event (defaults to the default branch of the repository)
  • $event The first non-flag argument is interpreted as the event for repository dispatches
  • $key=$value Any number of key-value pairs that are parsed and sent as a JSON object as the event payload

Context

In the GitHub ecosystem, a repository dispatch event is an event sent to a particular GitHub repository by a user, app, or tool with an arbitrary type and JSON payload. A workflow dispatch is an event that triggers a single workflow with a predefined set of inputs.

Since GitHub Actions allows workflows to be kicked off by these events, this flexibility makes repository and workflow dispatches a powerful tool for automating many day-to-day async tasks, such as app deployments, building and packaging, and many other use cases.