3
0
Fork 0
mirror of https://github.com/tj-actions/changed-files synced 2024-12-16 19:27:39 +00:00
changed-files/action.yml

220 lines
11 KiB
YAML
Raw Normal View History

2022-04-08 09:43:01 +00:00
name: Changed Files
2022-04-08 09:41:00 +00:00
description: Get all Added, Copied, Modified, Deleted, Renamed, Type changed, Unmerged, Unknown files.
2021-03-05 02:36:52 +00:00
author: tj-actions
2021-03-05 02:36:52 +00:00
inputs:
2021-03-05 12:25:17 +00:00
separator:
description: "Split character for output strings"
required: false
2021-03-05 12:25:17 +00:00
default: " "
include_all_old_new_renamed_files:
2022-10-29 21:48:36 +00:00
description: "Include `all_old_new_renamed_files` output. Note this can generate a large output See: [#501](https://github.com/tj-actions/changed-files/issues/501)."
required: false
default: "false"
old_new_separator:
2022-10-29 21:48:36 +00:00
description: "Split character for old and new filename pairs."
required: false
default: ","
old_new_files_separator:
2022-10-29 21:48:36 +00:00
description: "Split character for multiple old and new filename pairs."
required: false
default: " "
files_from_source_file:
2022-10-29 21:48:36 +00:00
description: "Source file(s) used to populate the `files` input."
required: false
default: ""
files:
2022-10-29 21:48:36 +00:00
description: "File and directory patterns to detect changes using only these list of file(s) (Defaults to the entire repo) **NOTE:** Multiline file/directory patterns should not include qoutes."
required: false
default: ""
files_separator:
2022-10-29 21:48:36 +00:00
description: "Separator used to split the `files` input"
default: "\n"
required: false
files_ignore:
2022-10-29 21:48:36 +00:00
description: "Ignore changes to these file(s) **NOTE:** Multiline file/directory patterns should not include qoutes."
required: false
default: ""
files_ignore_separator:
2022-10-29 21:48:36 +00:00
description: "Separator used to split the `files-ignore` input"
default: "\n"
required: false
files_ignore_from_source_file:
2022-10-29 21:48:36 +00:00
description: "Source file(s) used to populate the `files_ignore` input"
required: false
default: ""
sha:
2022-10-29 21:48:36 +00:00
description: "Specify a different commit SHA used for comparing changes"
required: false
default: ${{ github.sha }}
base_sha:
2022-10-29 21:48:36 +00:00
description: "Specify a different base commit SHA used for comparing changes"
required: false
since:
2022-10-29 21:48:36 +00:00
description: "Get changed files for commits whose timestamp is older than the given time."
required: false
default: ""
until:
2022-10-29 21:48:36 +00:00
description: "Get changed files for commits whose timestamp is earlier than the given time."
required: false
default: ""
path:
2022-10-29 21:48:36 +00:00
description: "Specify a relative path under `$GITHUB_WORKSPACE` to locate the repository."
required: false
default: "."
quotepath:
2022-10-29 21:48:36 +00:00
description: "Use non ascii characters to match files and output the filenames completely verbatim by setting this to `false`"
default: "true"
required: false
diff_relative:
2022-10-29 21:48:36 +00:00
description: "Exclude changes outside the current directory and show pathnames relative to it. **NOTE:** This requires you to specify the top level directory via the `path` input."
required: false
dir_names:
default: "false"
2022-10-29 21:48:36 +00:00
description: "Output unique changed directories instead of filenames. **NOTE:** This returns `.` for changed files located in the root of the project."
required: false
json:
2022-10-29 21:48:36 +00:00
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs."
required: false
default: "false"
2022-11-03 12:31:50 +00:00
fetch_depth:
2022-11-04 05:17:57 +00:00
description: "Limit depth of the branch history fetched. **NOTE**: This can be adjusted to resolve errors with insufficient history."
required: false
2022-11-05 01:08:02 +00:00
default: "40"
2021-03-05 12:25:17 +00:00
2021-03-05 03:43:17 +00:00
outputs:
added_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Added (A)."
value: ${{ steps.changed-files.outputs.added_files }}
2021-03-05 03:43:17 +00:00
copied_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Copied (C)."
value: ${{ steps.changed-files.outputs.copied_files }}
2021-03-05 03:43:17 +00:00
deleted_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Deleted (D)."
value: ${{ steps.changed-files.outputs.deleted_files }}
2021-03-05 03:43:17 +00:00
modified_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Modified (M)."
value: ${{ steps.changed-files.outputs.modified_files }}
2021-03-05 03:43:17 +00:00
renamed_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Renamed (R)."
value: ${{ steps.changed-files.outputs.renamed_files }}
2022-05-14 21:54:38 +00:00
all_old_new_renamed_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Renamed and list their old and new names. **NOTE:** This requires setting `include_all_old_new_renamed_files` to `true` (R)"
2022-05-14 21:54:38 +00:00
value: ${{ steps.changed-files.outputs.all_old_new_renamed_files }}
type_changed_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that have their file type changed (T)."
value: ${{ steps.changed-files.outputs.type_changed_files }}
2021-03-05 03:43:17 +00:00
unmerged_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Unmerged (U)."
value: ${{ steps.changed-files.outputs.unmerged_files }}
2021-03-05 03:43:17 +00:00
unknown_files:
2022-10-29 21:48:36 +00:00
description: "Returns only files that are Unknown (X)."
value: ${{ steps.changed-files.outputs.unknown_files }}
all_changed_and_modified_files:
2022-10-29 21:48:36 +00:00
description: "Returns all changed and modified files i.e. *a combination of (ACMRDTUX)*"
value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
all_changed_files:
2022-10-29 21:48:36 +00:00
description: "Returns all changed files i.e. *a combination of all added, copied, modified and renamed files (ACMR)*"
value: ${{ steps.changed-files.outputs.all_changed_files }}
2021-05-01 17:32:09 +00:00
any_changed:
2022-10-29 21:48:36 +00:00
description: "Returns `true` when any of the filenames provided using the `files` input has changed. If no `files` have been specified,an empty string `''` is returned. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
value: ${{ steps.changed-files.outputs.any_changed }}
only_changed:
2022-10-29 21:48:36 +00:00
description: "Returns `true` when only files provided using the `files` input has changed. If no `files` have been specified,an empty string `''` is returned. i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
value: ${{ steps.changed-files.outputs.only_changed }}
other_changed_files:
2022-10-29 21:48:36 +00:00
description: "Returns all other changed files not listed in the files input i.e. *using a combination of all added, copied, modified and renamed files (ACMR)*."
value: ${{ steps.changed-files.outputs.other_changed_files }}
all_modified_files:
2022-10-29 21:48:36 +00:00
description: "Returns all changed files i.e. *a combination of all added, copied, modified, renamed and deleted files (ACMRD)*."
value: ${{ steps.changed-files.outputs.all_modified_files }}
any_modified:
2022-10-29 21:48:36 +00:00
description: "Returns `true` when any of the filenames provided using the `files` input has been modified. If no `files` have been specified,an empty string `''` is returned. i.e. *using a combination of all added, copied, modified, renamed, and deleted files (ACMRD)*."
value: ${{ steps.changed-files.outputs.any_modified }}
only_modified:
2022-10-29 21:48:36 +00:00
description: "Returns `true` when only files provided using the `files` input has been modified. If no `files` have been specified,an empty string `''` is returned.(ACMRD)."
value: ${{ steps.changed-files.outputs.only_modified }}
other_modified_files:
2022-10-29 21:48:36 +00:00
description: "Returns all other modified files not listed in the files input i.e. *a combination of all added, copied, modified, and deleted files (ACMRD)*"
value: ${{ steps.changed-files.outputs.other_modified_files }}
any_deleted:
2022-10-29 21:48:36 +00:00
description: "Returns `true` when any of the filenames provided using the `files` input has been deleted. If no `files` have been specified,an empty string `''` is returned. (D)"
value: ${{ steps.changed-files.outputs.any_deleted }}
only_deleted:
2022-10-29 21:48:36 +00:00
description: "Returns `true` when only files provided using the `files` input has been deleted. If no `files` have been specified,an empty string `''` is returned. (D)"
value: ${{ steps.changed-files.outputs.only_deleted }}
other_deleted_files:
2022-10-29 21:48:36 +00:00
description: "Returns all other deleted files not listed in the files input i.e. *a combination of all deleted files (D)*"
value: ${{ steps.changed-files.outputs.other_deleted_files }}
2021-03-05 02:36:52 +00:00
runs:
using: "composite"
steps:
- run: |
# "Calculating the previous and current SHA..."
bash $GITHUB_ACTION_PATH/diff-sha.sh
id: changed-files-diff-sha
shell: bash
env:
GITHUB_SERVER_URL: ${{ github.server_url }}
GITHUB_REPOSITORY: ${{ github.repository }}
2022-11-04 21:55:29 +00:00
GITHUB_REF: ${{ github.ref }}
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_WORKSPACE: ${{ github.workspace }}
GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
GITHUB_EVENT_FORCED: ${{ github.event.forced }}
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
2022-09-24 06:34:19 +00:00
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
INPUT_SHA: ${{ inputs.sha }}
INPUT_BASE_SHA: ${{ inputs.base_sha }}
INPUT_SINCE: ${{ inputs.since }}
INPUT_UNTIL: ${{ inputs.until }}
INPUT_PATH: ${{ inputs.path }}
2022-11-03 12:31:50 +00:00
INPUT_FETCH_DEPTH: ${{ inputs.fetch_depth }}
Add support for using github's glob pattern syntax (#304) * Add support for using github's glob pattern syntax Fixes: #264 #265 * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update sourcefiles.sh * Update sourcefiles.sh * Update action.yml * Update action.yml * Update action.yml * Update action.yml * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update action.yml * Update test.yml * Update changed-files-list.txt * Update changed-files-list.txt * Update action.yml * Update action.yml * Update entrypoint.sh * Update test.yml * Update README.md * Update test.yml * Update entrypoint.sh * Update test.yml Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-05 02:38:03 +00:00
- name: Glob match
uses: tj-actions/glob@v15
Add support for using github's glob pattern syntax (#304) * Add support for using github's glob pattern syntax Fixes: #264 #265 * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update sourcefiles.sh * Update sourcefiles.sh * Update action.yml * Update action.yml * Update action.yml * Update action.yml * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update sourcefiles.sh * Update action.yml * Update test.yml * Update changed-files-list.txt * Update changed-files-list.txt * Update action.yml * Update action.yml * Update entrypoint.sh * Update test.yml * Update README.md * Update test.yml * Update entrypoint.sh * Update test.yml Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2022-01-05 02:38:03 +00:00
id: glob
with:
files: ${{ inputs.files }}
files-separator: ${{ inputs.files_separator }}
excluded-files: ${{ inputs.files_ignore }}
excluded-files-separator: ${{ inputs.files_ignore_separator }}
files-from-source-file: ${{ inputs.files_from_source_file }}
excluded-files-from-source-file: ${{ inputs.files_ignore_from_source_file}}
2022-09-25 00:12:07 +00:00
escape-paths: true
working-directory: ${{ inputs.path }}
base-sha: ${{ steps.changed-files-diff-sha.outputs.previous_sha }}
sha: ${{ steps.changed-files-diff-sha.outputs.current_sha }}
include-deleted-files: true
separator: "|"
- run: |
bash $GITHUB_ACTION_PATH/get-changed-paths.sh
id: changed-files
shell: bash
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
2022-10-20 19:19:57 +00:00
GITHUB_BASE_REF: ${{ github.base_ref }}
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
INPUT_FILES_PATTERN_FILE: ${{ steps.glob.outputs.paths-output-file }}
INPUT_SEPARATOR: ${{ inputs.separator }}
INPUT_PATH: ${{ inputs.path }}
INPUT_PREVIOUS_SHA: ${{ steps.changed-files-diff-sha.outputs.previous_sha }}
INPUT_CURRENT_SHA: ${{ steps.changed-files-diff-sha.outputs.current_sha }}
INPUT_TARGET_BRANCH: ${{ steps.changed-files-diff-sha.outputs.target_branch }}
INPUT_CURRENT_BRANCH: ${{ steps.changed-files-diff-sha.outputs.current_branch }}
INPUT_QUOTEPATH: ${{ inputs.quotepath }}
INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES: ${{ inputs.include_all_old_new_renamed_files }}
INPUT_OLD_NEW_SEPARATOR: ${{ inputs.old_new_separator }}
INPUT_OLD_NEW_FILES_SEPARATOR: ${{ inputs.old_new_files_separator }}
INPUT_DIFF_RELATIVE: ${{ inputs.diff_relative }}
INPUT_DIR_NAMES: ${{ inputs.dir_names }}
INPUT_JSON: ${{ inputs.json }}
INPUT_HAS_CUSTOM_PATTERNS: ${{ steps.glob.outputs.has-custom-patterns }}
2021-03-05 10:58:42 +00:00
2021-03-05 02:36:52 +00:00
branding:
2021-04-23 10:55:01 +00:00
icon: file-text
2021-03-05 02:36:52 +00:00
color: white