-
Notifications
You must be signed in to change notification settings - Fork 42
94 lines (81 loc) · 3 KB
/
pull_request.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
name: pull_request
run-name: Pull Request
on:
pull_request:
types: [opened, synchronize, reopened, closed]
# Prevent running concurrently
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ github.token }}
jobs:
get_changed_files:
name: Get changed files
runs-on: ubuntu-latest
outputs:
changed_files: ${{ steps.changed_files.outputs.changed_files }}
changed_python_files: ${{ steps.changed_files.outputs.changed_python_files }}
changed_yaml_files: ${{ steps.changed_files.outputs.changed_yaml_files }}
changed_json_files: ${{ steps.changed_files.outputs.changed_json_files }}
test_value: ${{ steps.changed_files.outputs.test_value }}
steps:
- uses: actions/checkout@v2
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: |
cpf=`python3 ${{ github.workspace }}/deploy/_filter_files.py py ${{ steps.changed_files.outputs.changed_files }}`
echo "Changed python files: $cpf"
echo "changed_python_files=$cpf" >> $GITHUB_OUTPUT
- name: Get changed yaml files
id: changed_yaml_files
shell: bash
run: |
cyf=`python3 ${{ github.workspace }}/deploy/_filter_files.py yml ${{ steps.changed_files.outputs.changed_files }}`
echo "Changed yaml files: $cyf"
echo "changed_yaml_files=$cyf" >> $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 "changed_json_files=$cjf" >> $GITHUB_OUTPUT
- name: Get test value
id: test_value
shell: bash
run: |
echo "test_value=foo" >> $GITHUB_OUTPUT
echo_changed_files:
needs: get_changed_files
name: Echo changed files
runs-on: ubuntu-latest
steps:
- name: Echo changed files
run: |
echo ${{ toJson(needs.get_changed_files.outputs) }}
# format:
# name: Check format of python
# needs: get_changed_files
# uses: ./.github/workflows/format.yml
# with:
# files: ${{ needs.get_changed_files.outputs.changed_files }}
# lint:
# name: Lint python
# needs: get_changed_files
# uses: ./.github/workflows/lint.yml
# with:
# files: ${{ needs.get_changed_files.outputs.changed_files }}
# run_tests:
# name: Run tests
# uses: ./.github/workflows/tests.yml