Finds files that have uncommitted changes using simple-git. In other words, the action finds files that have been changed or created by other actions.
Uses micromatch for pattern matching.
- name: Look for changed files
uses: wkillerud/changed-files@1.0.0
id: lfcf
with:
# See the micromatch docs for more examples: https://github.com/micromatch/micromatch#matching-features
patterns: |
**/__image_snapshots__/*
**/new.txt
- name: Upload changed files
if: steps.lfcf.outputs.has_changed_files == 'true'
uses: actions/upload-artifact@v2
with:
name: changed-files
# GitHub will find the lowest common folder to reduce the number of folders
# in the uploaded artifact. If you want to preserve the same folder structure
# as in your repository when downloading the artifact, include a file from
# the root of your repository.
path: |
package.json
${{ steps.lfcf.outputs.changed_files }}
A micromatch
-compatible pattern, optionally a multiline string with several patterns. Refer to the micromatch
documentation for advanced pattern examples.
Type: String
(required)
An option passed to micromatch
, optionally a multiline string with several patterns. Refer to the micromatch
documentation for advanced pattern examples.
Type: String
Set it to array
if you want a stringified JSON array as output instead of the default multiline string.
Type: "string" | "array"
Default: "string"
true
if there are new or changed files matching a pattern, otherwise it's false
.
Type: Boolean
Either a stringified JSON array or a string with files separated by newline, depending on the output
variable.
Type: String
Default: a string with files separated by newline