32
32
REPO_OWNER=${{ github.repository_owner }}
33
33
REPO_NAME=${{ github.event.repository.name }}
34
34
35
- # calling GitHub API for changed files in PR
35
+ # calling GitHub API for changed files in PR, the result is in string format.
36
36
CHANGED_FILES=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
37
37
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$PR_NUMBER/files" | \
38
38
jq -r '.[].filename' | tr '\n' ' ')
44
44
- name : Check Java changes
45
45
id : java
46
46
run : |
47
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^(java/|pom.xml)'; then
47
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n'| grep -qE '^(java/|pom.xml)'; then
48
48
echo "::set-output name=java::true"
49
49
else
50
50
echo "::set-output name=java::false"
53
53
- name : Check C++ changes
54
54
id : cpp
55
55
run : |
56
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^cpp/'; then
56
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n'| grep -qE '^cpp/'; then
57
57
echo "::set-output name=cpp::true"
58
58
else
59
59
echo "::set-output name=cpp::false"
62
62
- name : Check Golang changes
63
63
id : golang
64
64
run : |
65
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^golang/'; then
65
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n' | grep -qE '^golang/'; then
66
66
echo "::set-output name=golang::true"
67
67
else
68
68
echo "::set-output name=golang::false"
71
71
- name : Check C# changes
72
72
id : csharp
73
73
run : |
74
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^csharp/'; then
74
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n' | grep -qE '^csharp/'; then
75
75
echo "::set-output name=csharp::true"
76
76
else
77
77
echo "::set-output name=csharp::false"
80
80
- name : Check PHP changes
81
81
id : php
82
82
run : |
83
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^php/'; then
83
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n' | grep -qE '^php/'; then
84
84
echo "::set-output name=php::true"
85
85
else
86
86
echo "::set-output name=php::false"
89
89
- name : Check Rust changes
90
90
id : rust
91
91
run : |
92
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^rust/'; then
92
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n' | grep -qE '^rust/'; then
93
93
echo "::set-output name=rust::true"
94
94
else
95
95
echo "::set-output name=rust::false"
98
98
- name : Check Python changes
99
99
id : python
100
100
run : |
101
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^python/'; then
101
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n' | grep -qE '^python/'; then
102
102
echo "::set-output name=python::true"
103
103
else
104
104
echo "::set-output name=python::false"
@@ -107,7 +107,7 @@ jobs:
107
107
- name : Check Node.js changes
108
108
id : nodejs
109
109
run : |
110
- if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^nodejs/'; then
110
+ if echo "${{ steps.changed_files.outputs.files }}" | tr ' ' '\n' | grep -qE '^nodejs/'; then
111
111
echo "::set-output name=nodejs::true"
112
112
else
113
113
echo "::set-output name=nodejs::false"
0 commit comments