Skip to content

Commit 6c8ae8c

Browse files
committed
Add GitHub Actions workflow for generating Thrift code and updating soccer_service.thrift
1 parent 26c46cc commit 6c8ae8c

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

.github/workflows/generate.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Generate Thrift Code
2+
3+
on:
4+
push:
5+
branches:
6+
- github_action_test
7+
pull_request:
8+
branches:
9+
- github_action_test
10+
11+
jobs:
12+
generate:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: '3.x'
25+
26+
- name: Install Thrift
27+
run: |
28+
sudo apt-get install -y thrift-compiler
29+
python3 -m pip install --upgrade pip
30+
pip install -r requirements.txt
31+
32+
- name: Run generate.sh
33+
run: |
34+
chmod +x ./generate.sh
35+
./generate.sh
36+
37+
- name: Check for changes
38+
run: |
39+
git config --global user.name "github-actions[bot]"
40+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
41+
git add soccer/*
42+
if ! git diff --cached --quiet; then
43+
git commit -m "Automated update: Generated Thrift classes"
44+
else
45+
echo "No changes detected, skipping commit."
46+
fi
47+
48+
- name: Push changes
49+
if: github.event_name == 'push' && github.ref == 'refs/heads/github_action_test'
50+
run: |
51+
git push origin github_action_test
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

idl/soccer_service.thrift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ namespace py soccer
66
enum ViewWidth {
77
NARROW = 0,
88
NORMAL = 1,
9-
WIDE = 2
9+
WIDE = 2,
10+
test = 3
1011
}
1112

1213
enum AgentType {

0 commit comments

Comments
 (0)