$ show styfle/cancel-workflow-action
This repository implements a GitHub Action that cancels previous workflow runs that are not completed (queued or in_progress) for a given workflow. The action is written in TypeScript and bundled using vercel/ncc for distribution. It processes inputs to determine which workflows to target, handles various GitHub events (push, pull_request, workflow_run), and uses the GitHub API via @actions/github to query and cancel workflow runs based on configurable conditions like ignoring SHA, canceling all but the latest, filtering by status, or force canceling. The architecture is a single source file (src/index.ts) that collects context from the GitHub Actions environment, resolves target workflows, lists relevant runs, applies filters, and cancels matching runs. The action demonstrates proper error handling, logging, and use of the GitHub Actions toolkit, making it a reliable tool for managing workflow concurrency.
The LLM identified 1 files worth highlighting for reuse:
The core implementation of the GitHub Action that cancels previous workflow runs. It handles various GitHub events, processes inputs, queries the GitHub API, and cancels runs based on configurable conditions. Demonstrates solid API usage and error handling for a GitHub Action.