-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
53 lines (39 loc) · 1.27 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
name: 'get_git_diff_files'
description: 'Get names of files that are different between git branches'
inputs:
result_env_var:
description: 'Environment Variable name for result'
required: true
head_ref:
description: 'Reference to Git Head to compare with'
required: true
base_ref:
description: 'Reference to Git current'
required: true
grep_args:
description: 'Arguments to filter the result'
required: false
default: ''
workspace:
description: 'Workspace where the git project is'
required: false
default: '/.'
add_deleted:
description: 'Wether to add in list result those files that have been removed'
required: false
default: false
runs:
using: composite
steps:
- name: get_git_diff_files
run: |
echo "::group::Get git modified files in ${{ inputs.workspace }}"
if [ "${{ inputs.add_deleted }}" == "true" ]; then
export GIT_FLAGS_=""
else
export GIT_FLAGS_="--diff-filter=d"
fi
cd ${{ inputs.workspace }}
echo "${{ inputs.result_env_var }}=$(git diff --name-only ${{ inputs.base_ref }} ${{ inputs.head_ref }} ${GIT_FLAGS_} | grep ${{ inputs.grep_args }} | tr '\n' ' ')" >> $GITHUB_ENV
echo "::endgroup::"
shell: bash