-
-
Notifications
You must be signed in to change notification settings - Fork 175
/
action.yml
241 lines (237 loc) · 10.1 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Changed Files
description: Get all Added, Copied, Modified, Deleted, Renamed, Type changed, Unmerged, Unknown files.
author: tj-actions
inputs:
separator:
description: "Split character for output strings"
required: false
default: " "
include_all_old_new_renamed_files:
description: "Include all_old_new_renamed_files output. Note this can generate a large debug output See: #501."
required: false
default: "false"
old_new_separator:
description: "Split character for old and new filename pairs"
required: false
default: ","
old_new_files_separator:
description: "Split character for multiple old and new filename pairs"
required: false
default: " "
files_from_source_file:
description: "Source file(s) to populate the files input"
required: false
default: ""
files:
description: "Check for changes using only this list of files (Defaults to the entire repo)"
required: false
default: ""
files_separator:
description: "Separator used to split the files input"
default: "\n"
required: false
files_ignore:
description: "Ignore changes to this list of files"
required: false
default: ""
files_ignore_separator:
description: "Separator used to split the files-ignore input"
default: "\n"
required: false
files_ignore_from_source_file:
description: "Source file(s) to populate the files-ignore input"
required: false
default: ""
sha:
description: "Specify a current commit SHA used for comparing changes"
required: true
default: ${{ github.sha }}
base_sha:
description: "Specify a base commit SHA on used for comparing changes"
required: false
since_last_remote_commit:
description: "Use the last commit on the remote branch as the base_sha for push event."
required: false
default: "false"
since:
description: "Get changed files for commits whose timestamp is older than the given time"
required: false
default: ""
until:
description: "Get changed files for commits whose timestamp is earlier than the given time"
required: false
default: ""
path:
description: "Specify a relative path under $GITHUB_WORKSPACE to locate the repository"
required: false
default: "."
quotepath:
description: "Output filenames completely verbatim by setting this to false"
default: "true"
required: false
diff_relative:
description: "Exclude changes outside the current directory and show pathnames relative to it"
required: false
dir_names:
default: "false"
description: "Output the absolute path to the changed directories instead of the filenames"
required: false
json:
description: "Output changed files in JSON format which can be used for matrix jobs"
required: false
default: "false"
outputs:
added_files:
description: List of added files.
value: ${{ steps.changed-files.outputs.added_files }}
copied_files:
description: List of copied files.
value: ${{ steps.changed-files.outputs.copied_files }}
deleted_files:
description: List of deleted files.
value: ${{ steps.changed-files.outputs.deleted_files }}
modified_files:
description: List of modified files.
value: ${{ steps.changed-files.outputs.modified_files }}
renamed_files:
description: List of renamed files.
value: ${{ steps.changed-files.outputs.renamed_files }}
all_old_new_renamed_files:
description: List of all old and new names of renamed files.
value: ${{ steps.changed-files.outputs.all_old_new_renamed_files }}
type_changed_files:
description: List of files that had type changes.
value: ${{ steps.changed-files.outputs.type_changed_files }}
unmerged_files:
description: List of unmerged files.
value: ${{ steps.changed-files.outputs.unmerged_files }}
unknown_files:
description: List of unknown files.
value: ${{ steps.changed-files.outputs.unknown_files }}
all_changed_and_modified_files:
description: List of all changed files.
value: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
all_changed_files:
description: List of all copied, modified, and added files.
value: ${{ steps.changed-files.outputs.all_changed_files }}
any_changed:
description: Return true only when any files provided using the files input have changed.
value: ${{ steps.changed-files.outputs.any_changed }}
only_changed:
description: Return true when all files provided using the files input have changed.
value: ${{ steps.changed-files.outputs.only_changed }}
other_changed_files:
description: Return list of changed files not listed in the files input.
value: ${{ steps.changed-files.outputs.other_changed_files }}
all_modified_files:
description: List of all copied, modified, added and deleted files.
value: ${{ steps.changed-files.outputs.all_modified_files }}
any_modified:
description: Return true only when any files provided using the files input have been modified.
value: ${{ steps.changed-files.outputs.any_modified }}
only_modified:
description: Return true when all files provided using the files input have been modified.
value: ${{ steps.changed-files.outputs.only_modified }}
other_modified_files:
description: Return list of modified files not listed in the files input.
value: ${{ steps.changed-files.outputs.other_modified_files }}
any_deleted:
description: Return true only when any files provided using the files input have been deleted.
value: ${{ steps.changed-files.outputs.any_deleted }}
only_deleted:
description: Return true when all files provided using the files input have been deleted.
value: ${{ steps.changed-files.outputs.only_deleted }}
other_deleted_files:
description: Return list of deleted files not listed in the files input.
value: ${{ steps.changed-files.outputs.other_deleted_files }}
runs:
using: "composite"
steps:
- run: |
# "Calculate the base sha..."
bash $GITHUB_ACTION_PATH/get-base-sha.sh
id: base-sha
shell: bash
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
GITHUB_EVENT_BEFORE: ${{ github.event.before }}
# 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_SINCE: ${{ inputs.since }}
INPUT_BASE_SHA: ${{ inputs.base_sha }}
INPUT_SHA: ${{ inputs.sha }}
INPUT_PATH: ${{ inputs.path }}
INPUT_SINCE_LAST_REMOTE_COMMIT: ${{ inputs.since_last_remote_commit }}
- run: |
# "Calculate the sha..."
bash $GITHUB_ACTION_PATH/get-sha.sh
id: sha
shell: bash
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
# 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_UNTIL: ${{ inputs.until }}
INPUT_SHA: ${{ inputs.sha }}
INPUT_PATH: ${{ inputs.path }}
- 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 }}
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_HEAD_REF: ${{ github.head_ref }}
GITHUB_WORKSPACE: ${{ github.workspace }}
GITHUB_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
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
INPUT_SHA: ${{ steps.sha.outputs.sha }}
INPUT_BASE_SHA: ${{ steps.base-sha.outputs.base_sha }}
INPUT_PATH: ${{ inputs.path }}
- name: Glob match
uses: tj-actions/glob@v13
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}}
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 }}
# 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 }}
branding:
icon: file-text
color: white