Skip to content

Commit e8796f1

Browse files
committed
Update gRPC code generation workflow
1 parent d8e8fa4 commit e8796f1

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

.github/workflows/grpc-generate.yml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Generate gRPC Code
33
on:
44
push:
55
branches:
6-
- main
6+
- main
77
pull_request:
88
branches:
9-
- main
9+
- main
1010

1111
jobs:
1212
generate:
@@ -15,18 +15,36 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v3
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
1820

1921
- name: Set up Python
20-
uses: actions/setup-python@v3
22+
uses: actions/setup-python@v4
2123
with:
22-
python-version: '3.x' # Specify your desired Python version
24+
python-version: '3.x'
2325

2426
- name: Install gRPC tools
2527
run: |
2628
python3 -m pip install --upgrade pip
27-
pip install grpcio-tools
28-
29+
pip install -r requirements.txt
30+
2931
- name: Run generate.sh
3032
run: |
31-
chmod +x ./generate.sh
33+
chmod +x ./generate.sh
3234
./generate.sh
35+
- name: Check for changes
36+
run: |
37+
git config --global user.name "github-actions[bot]"
38+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
39+
git add .
40+
if ! git diff --cached --quiet; then
41+
git commit -m "Automated update: Generated Thrift classes"
42+
else
43+
echo "No changes detected, skipping commit."
44+
fi
45+
- name: Push changes
46+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
47+
run: |
48+
git push origin main
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)