Skip to content

Commit 90c381a

Browse files
committed
Update branch name in generate.yml and add push section
1 parent da17758 commit 90c381a

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

.github/workflows/generate.yml

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

1111
jobs:
1212
generate:
@@ -15,28 +15,39 @@ jobs:
1515
steps:
1616
- name: Checkout code
1717
uses: actions/checkout@v3
18-
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
1921
- name: Set up Python
2022
uses: actions/setup-python@v4
2123
with:
22-
python-version: '3.x'
24+
python-version: '3.x'
2325

2426
- name: Install Thrift
2527
run: |
2628
sudo apt-get install -y thrift-compiler
2729
python3 -m pip install --upgrade pip
2830
pip install -r requirements.txt
29-
31+
3032
- name: Run generate.sh
3133
run: |
3234
chmod +x ./generate.sh
3335
./generate.sh
34-
- name: Commit and push generated files
36+
37+
- name: Check for changes
3538
run: |
3639
git config --global user.name "github-actions[bot]"
3740
git config --global user.email "github-actions[bot]@users.noreply.github.com"
3841
git add soccer/*
39-
git commit -m "Automated update: Generated Thrift classes"
40-
git push origin develop
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/main'
50+
run: |
51+
git push origin main
4152
env:
4253
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)