get-touching-prs
is a module + CLI tool that helps you find open GitHub pull requests that modify certain files.
npm i -g get-touching-prs
## or
yarn global add get-touching-prs
Ensure that the GITHUB_TOKEN
environment variable contains a valid GitHub Personal Access Token. Then, run:
get-touching-prs --owner <owner> --repo <repo> glob1 [glob2...]
A list of matching open PRs and conflicting files will be returned.
For example, to get a list of all currently modified .coffee
files in cypress-io/cypress
, you could run:
get-touching-prs --owner cypress-io --repo cypress '**/*.coffee'
Excerpt from output:
39 PRs touching the supplied patterns were found in cypress-io/cypress:
- render ansi colors for file:preprocessor error message - @Bkucera - https://github.com/cypress-io/cypress/pull/6535
Potentially conflicting files: 2
- packages/server/lib/plugins/preprocessor.coffee (+4, -3) matching glob **/*.coffee
- packages/server/test/unit/plugins/preprocessor_spec.coffee (+1, -1) matching glob **/*.coffee
...
const { getTouchingPrs } = require('get-touching-prs')
// see src/index.ts for types
getTouchingPrs(owner, repo, ghToken, patterns)