@beesley/pr-metadata
v1.0.6
Published
A cli tool for reading information about pull requests within github actions.
Downloads
277
Readme
@beesley/pr-metadata
A tool for reading information about pull requests within github actions. Works as a cli or as a node module. Expects a GITHUB_TOKEN env var to be set.
CLI Usage
npx @beesley/pr-metadata --help
# Options:
# --help Show help [boolean]
# --version Show version number [boolean]
# --dirNames Whether to return directory names instead of file names [boolean] [default: false]
# --json Whether to return result as a json string [boolean] [default: true]
# --filter An array of globs to act as an include filter for where we look for changes [array]
npx @beesley/pr-metadata
# [".commitlintrc.json","src/__mocks__/mock-context.json","src/__mocks__/push-event.json","src/get-changed-files.test.ts","src/get-changed-files.ts","src/index.ts"]
npx @beesley/pr-metadata --json false
# [
# '.commitlintrc.json',
# 'src/__mocks__/mock-context.json',
# 'src/__mocks__/push-event.json',
# 'src/get-changed-files.test.ts',
# 'src/get-changed-files.ts',
# 'src/index.ts'
# ]
npx @beesley/pr-metadata --dirNames
# ["bin","src/__mocks__","src"]
npx @beesley/pr-metadata --dirNames --filter '**' --filter '!**/__mocks__/**'
# ["bin","src"]
npx @beesley/pr-metadata --filter 'src/**'
# ["src/__mocks__/mock-context.json","src/__mocks__/push-event.json","src/get-changed-files.test.ts","src/get-changed-files.ts","src/index.ts"]
API
Table of Contents
getChangedFiles
src/get-changed-files.ts:13-17
Uses github actions metadata to get a list of changes files or directories
Parameters
json
boolean Whether or not to return jsondirNames
boolean Whether or not to return only directory namesfilter
Array<string>? Filter globs to filter results using
Returns any {(Promise<string | string[]>)} The changed files or directories