Skip to content

Commit b6fc23b

Browse files
authored
Use script to check changed files instead for dorny/paths-filter@v2 in action workflows (#993)
1 parent 109dbc4 commit b6fc23b

File tree

2 files changed

+102
-30
lines changed

2 files changed

+102
-30
lines changed

.github/workflows/build.yml

Lines changed: 101 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,109 @@ on:
99
jobs:
1010
paths-filter:
1111
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
1214
outputs:
13-
java: ${{ steps.filter.outputs.java }}
14-
cpp: ${{ steps.filter.outputs.cpp }}
15-
golang: ${{ steps.filter.outputs.golang }}
16-
csharp: ${{ steps.filter.outputs.csharp }}
17-
php: ${{ steps.filter.outputs.php }}
18-
rust: ${{ steps.filter.outputs.rust }}
19-
python: ${{ steps.filter.outputs.python }}
20-
nodejs: ${{ steps.filter.outputs.nodejs }}
15+
java: ${{ steps.java.outputs.java }}
16+
cpp: ${{ steps.cpp.outputs.cpp }}
17+
golang: ${{ steps.golang.outputs.golang }}
18+
csharp: ${{ steps.csharp.outputs.csharp }}
19+
php: ${{ steps.php.outputs.php }}
20+
rust: ${{ steps.rust.outputs.rust }}
21+
python: ${{ steps.python.outputs.python }}
22+
nodejs: ${{ steps.nodejs.outputs.nodejs }}
2123
steps:
22-
- uses: actions/checkout@v2
23-
- uses: dorny/paths-filter@v2
24-
id: filter
25-
with:
26-
filters: |
27-
java:
28-
- 'java/**'
29-
cpp:
30-
- 'cpp/**'
31-
golang:
32-
- 'golang/**'
33-
csharp:
34-
- 'csharp/**'
35-
php:
36-
- 'php/**'
37-
rust:
38-
- 'rust/**'
39-
python:
40-
- 'python/**'
41-
nodejs:
42-
- 'nodejs/**'
24+
- uses: actions/checkout@v4
25+
- name: Get changed files (Push/Pull Request)
26+
id: changed_files
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
run: |
30+
if [ "${{ github.event_name }}" = "pull_request" ]; then
31+
PR_NUMBER=${{ github.event.pull_request.number }}
32+
REPO_OWNER=${{ github.repository_owner }}
33+
REPO_NAME=${{ github.event.repository.name }}
34+
35+
# calling GitHub API for changed files in PR
36+
CHANGED_FILES=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
37+
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$PR_NUMBER/files" | \
38+
jq -r '.[].filename' | tr '\n' ' ')
39+
else
40+
CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
41+
fi
42+
echo "::set-output name=files::$CHANGED_FILES"
43+
44+
- name: Check Java changes
45+
id: java
46+
run: |
47+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^(java/|pom.xml)'; then
48+
echo "::set-output name=java::true"
49+
else
50+
echo "::set-output name=java::false"
51+
fi
52+
53+
- name: Check C++ changes
54+
id: cpp
55+
run: |
56+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^cpp/'; then
57+
echo "::set-output name=cpp::true"
58+
else
59+
echo "::set-output name=cpp::false"
60+
fi
61+
62+
- name: Check Golang changes
63+
id: golang
64+
run: |
65+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^golang/'; then
66+
echo "::set-output name=golang::true"
67+
else
68+
echo "::set-output name=golang::false"
69+
fi
70+
71+
- name: Check C# changes
72+
id: csharp
73+
run: |
74+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^csharp/'; then
75+
echo "::set-output name=csharp::true"
76+
else
77+
echo "::set-output name=csharp::false"
78+
fi
79+
80+
- name: Check PHP changes
81+
id: php
82+
run: |
83+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^php/'; then
84+
echo "::set-output name=php::true"
85+
else
86+
echo "::set-output name=php::false"
87+
fi
88+
89+
- name: Check Rust changes
90+
id: rust
91+
run: |
92+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^rust/'; then
93+
echo "::set-output name=rust::true"
94+
else
95+
echo "::set-output name=rust::false"
96+
fi
97+
98+
- name: Check Python changes
99+
id: python
100+
run: |
101+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^python/'; then
102+
echo "::set-output name=python::true"
103+
else
104+
echo "::set-output name=python::false"
105+
fi
106+
107+
- name: Check Node.js changes
108+
id: nodejs
109+
run: |
110+
if echo "${{ steps.changed_files.outputs.files }}" | grep -qE '^nodejs/'; then
111+
echo "::set-output name=nodejs::true"
112+
else
113+
echo "::set-output name=nodejs::false"
114+
fi
43115
java-build:
44116
needs: [paths-filter]
45117
if: ${{ needs.paths-filter.outputs.java == 'true' }}

java/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ We picked [Logback](https://logback.qos.ch/) and shaded it into the client imple
6565

6666
The following logging parameters are all supported for specification by JVM system parameters (for example, `java -Drocketmq.log.level=INFO -jar foobar.jar`) or environment variables.
6767

68-
* `rocketmq.log.level`: log output level, default is INFO.
68+
* `rocketmq.log.level`: the log output level, default is INFO.
6969
* `rocketmq.log.root`: the root directory of the log output, default is `$HOME/logs/rocketmq`, so the full path is `$HOME/logs/rocketmq/rocketmq-client.log`.
7070
* `rocketmq.log.file.maxIndex`: the maximum number of log files to keep, default is 10 (the size of a single log file is limited to 64 MB, no adjustment is supported now).
7171

0 commit comments

Comments
 (0)