Fix GitHub Actions - Clean Lint workflow- bug - if gpg keys not found #27
Workflow file for this run
This file contains 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
on: | |
pull_request: | |
branches: [main] | |
types: [opened, reopened, synchronize, assigned, review_requested] | |
jobs: | |
clean-and-lint: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.8' | |
- name: Install dependencies and run clean and lint | |
working-directory: model_demos | |
run: | | |
python -m venv venv | |
source venv/bin/activate && \ | |
pip install --upgrade pip==24.0 && \ | |
pip install -r requirements-dev.txt && \ | |
make clean | |
make clean_tt | |
make style | |
- name: Check if GPG key exists | |
id: check-gpg-key | |
run: echo ::set-output name=key_exists::$(if [ -n "${{ secrets.GPG_PRIVATE_KEY }}" ]; then echo "true"; else echo "false"; fi) | |
- name: Commit changes with or without GPG signing | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: '*** AUTOMATED COMMIT | Applied Code Formatting and Cleanup ✨ 🍰 ✨***' | |
commit_user_name: CleanBot | |
commit_user_email: [email protected] | |
commit_options: ${{ steps.check-gpg-key.outputs.key_exists == 'true' && '-S' || '' }} |