Skip to content

Commit 14e9d55

Browse files
authored
Use script to check changed files instead for dorny/paths-filter@v2 in action workflows. (#994)
* use script to check changed files instead for dorny/paths-filter@v2
1 parent b6fc23b commit 14e9d55

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
REPO_OWNER=${{ github.repository_owner }}
3333
REPO_NAME=${{ github.event.repository.name }}
3434
35-
# calling GitHub API for changed files in PR
35+
# calling GitHub API for changed files in PR, the result is in string format.
3636
CHANGED_FILES=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
3737
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$PR_NUMBER/files" | \
3838
jq -r '.[].filename' | tr '\n' ' ')
@@ -44,7 +44,7 @@ jobs:
4444
- name: Check Java changes
4545
id: java
4646
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
4848
echo "::set-output name=java::true"
4949
else
5050
echo "::set-output name=java::false"
@@ -53,7 +53,7 @@ jobs:
5353
- name: Check C++ changes
5454
id: cpp
5555
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
5757
echo "::set-output name=cpp::true"
5858
else
5959
echo "::set-output name=cpp::false"
@@ -62,7 +62,7 @@ jobs:
6262
- name: Check Golang changes
6363
id: golang
6464
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
6666
echo "::set-output name=golang::true"
6767
else
6868
echo "::set-output name=golang::false"
@@ -71,7 +71,7 @@ jobs:
7171
- name: Check C# changes
7272
id: csharp
7373
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
7575
echo "::set-output name=csharp::true"
7676
else
7777
echo "::set-output name=csharp::false"
@@ -80,7 +80,7 @@ jobs:
8080
- name: Check PHP changes
8181
id: php
8282
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
8484
echo "::set-output name=php::true"
8585
else
8686
echo "::set-output name=php::false"
@@ -89,7 +89,7 @@ jobs:
8989
- name: Check Rust changes
9090
id: rust
9191
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
9393
echo "::set-output name=rust::true"
9494
else
9595
echo "::set-output name=rust::false"
@@ -98,7 +98,7 @@ jobs:
9898
- name: Check Python changes
9999
id: python
100100
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
102102
echo "::set-output name=python::true"
103103
else
104104
echo "::set-output name=python::false"
@@ -107,7 +107,7 @@ jobs:
107107
- name: Check Node.js changes
108108
id: nodejs
109109
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
111111
echo "::set-output name=nodejs::true"
112112
else
113113
echo "::set-output name=nodejs::false"

0 commit comments

Comments
 (0)