clean: add if __name__ == "__main__" in prepare_readme.py tto avoid modifications to README-PYPI.md when collecting tests #774
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: Linting Python custom files | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@7f4fc3e22c37d6ff65e88745f38bd3157c663f7c # v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6 | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras | |
| # The init, sdkhooks.py and types.py files in the _hooks folders are generated by Speakeasy hence the exclusion | |
| - name: Run all linters | |
| run: scripts/lint_custom_code.sh | |
| lint_custom_code_required: | |
| runs-on: ubuntu-latest | |
| needs: lint | |
| if: ${{ always() }} | |
| steps: | |
| - name: Require custom code lint to pass | |
| run: | | |
| if [ "${{ needs.lint.result }}" != "success" ]; then | |
| echo "Expected custom code lint to pass, got: ${{ needs.lint.result }}" | |
| exit 1 | |
| fi |