https://github.com/amezin/detect-changes-action
Check whether any files matching the specified glob pattern(s) were changed in a pull request or push (or between two arbitrary commits)
https://github.com/amezin/detect-changes-action
action actions github-action github-actions github-api
Last synced: 3 months ago
JSON representation
Check whether any files matching the specified glob pattern(s) were changed in a pull request or push (or between two arbitrary commits)
- Host: GitHub
- URL: https://github.com/amezin/detect-changes-action
- Owner: amezin
- License: mit
- Created: 2026-01-22T19:24:34.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-03-13T17:49:17.000Z (3 months ago)
- Last Synced: 2026-03-14T05:53:23.407Z (3 months ago)
- Topics: action, actions, github-action, github-actions, github-api
- Language: TypeScript
- Homepage:
- Size: 3.05 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Detect changes
Check whether files matching the specified glob patterns were changed
in a pull request or push (or between two arbitrary commits).
This action uses GitHub API and not `git` CLI,
so it won't work for local commits that weren't pushed to GitHub.
Intended use: skip jobs or steps if relevant files were not changed.
## Inputs
### `repository`
The owner and repository name, in `owner/name` format.
**Default**: `${{ github.repository }}` -
the repository where the workflow was triggered.
### `files`
File path/name glob patterns to check, one pattern per line.
No default value. Required input.
Patterns starting with `!` exclude files.
Last matched pattern determines whether to include or exclude the file.
Only files are matched. To include directories, use `dir/**` syntax.
Only Unix path separator `/` is used, even on Windows.
See [minimatch](https://www.npmjs.com/package/minimatch) documentation
for syntax details.
### `base`
Base commit/branch to compare.
**Default**: Pull request/merge group base branch/commit.
Or the previous branch head for `push` event.
### `head`
Head commit/branch to compare.
**Default**: `${{ github.event.pull_request.merge_commit_sha }}` for `pull_request_target` event,
otherwise `${{ github.sha }}` - the "current commit" or merge commit for pull requests.
> [!NOTE]
> There is a special case for `pull_request_target` event -
> because `${{ github.sha }}` will be the head of the base branch for `pull_request_target`.
### `ignore-removed`
Ignore removed files - return `false` if all changes are just removals.
**Default**: `false`
### `github-token`
GitHub API token to use.
**Default**: `${{ github.token }}`
## Outputs
### `changed`
`true` if a change in `files` was detected, `false` otherwise.
There is no output with a file list, because GitHub API can return
an incomplete list of changed files (it returns up to 300 files) - see
https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits.
When an incomplete list is detected, `changed` is always set to `true`,
even if the list doesn't contain any file matching `files` input.