-
Notifications
You must be signed in to change notification settings - Fork 42
71 lines (66 loc) · 2.75 KB
/
JOB_get_changed_files.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
name: get_changed_files
run-name: Get changed get_changed_files
on:
workflow_call:
outputs:
changed_files:
description: "Changed files"
value: ${{ jobs.get_changed_files.outputs.changed_files }}
python_changed_files:
description: "Changed python files"
value: ${{ jobs.get_changed_files.outputs.python_changed_files }}
yaml_changed_files:
description: "Changed yaml files"
value: ${{ jobs.get_changed_files.outputs.yaml_changed_files }}
json_changed_files:
description: "Changed json files"
value: ${{ jobs.get_changed_files.outputs.json_changed_files }}
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: read
jobs:
get_changed_files:
name: Get changed files
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed_files.outputs.changed_files }}
python_changed_files: ${{ steps.changed_python_files.outputs.python_changed_files }}
yaml_changed_files: ${{ steps.changed_yaml_files.outputs.yaml_changed_files }}
json_changed_files: ${{ steps.changed_json_files.outputs.json_changed_files }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.head_ref || github.ref }}
- name: Get changed files
id: changed_files
shell: bash
run: |
changed_files=`gh pr diff ${{ github.event.number }} --name-only | xargs`
echo "Changed files: $changed_files"
echo "changed_files=$changed_files" >> $GITHUB_OUTPUT
- name: Get changed python files
id: changed_python_files
shell: bash
run: |
changed_files=`python3 ${{ github.workspace }}/deploy/_filter_files.py py ${{ steps.changed_files.outputs.changed_files }}`
echo "Changed python files: $changed_files"
echo "python_changed_files=$changed_files" >> $GITHUB_OUTPUT
- name: Get changed yaml files
id: changed_yaml_files
shell: bash
run: |
changed_files=`python3 ${{ github.workspace }}/deploy/_filter_files.py yml ${{ steps.changed_files.outputs.changed_files }}`
echo "Changed yaml files: $changed_files"
echo "yaml_changed_files=$changed_files" >> $GITHUB_OUTPUT
- name: Get changed json files
id: changed_json_files
shell: bash
run: |
cjf=`python3 ${{ github.workspace }}/deploy/_filter_files.py json ${{ steps.changed_files.outputs.changed_files }}`
echo "Changed json files: $cjf"
echo "json_changed_files=$cjf" >> $GITHUB_OUTPUT