Add GitHub Actions workflow for generating Thrift code and updating s… #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Thrift Code | |
on: | |
push: | |
branches: | |
- github_action_test | |
pull_request: | |
branches: | |
- github_action_test | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install Thrift | |
run: | | |
sudo apt-get install -y thrift-compiler | |
python3 -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run generate.sh | |
run: | | |
chmod +x ./generate.sh | |
./generate.sh | |
- name: Check for changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add soccer/* | |
if ! git diff --cached --quiet; then | |
git commit -m "Automated update: Generated Thrift classes" | |
else | |
echo "No changes detected, skipping commit." | |
fi | |
- name: Push changes | |
if: github.event_name == 'push' && github.ref == 'refs/heads/github_action_test' | |
run: | | |
git push origin github_action_test | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |