style: format code for better readability in command_bot.py #9
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: Conventional Commits | |
| on: | |
| push: | |
| tags-ignore: | |
| - "v*" | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| jobs: | |
| commit-subjects: | |
| name: Validate commit messages | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Resolve commit range | |
| id: commit_range | |
| run: | | |
| set -euo pipefail | |
| if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then | |
| range="${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" | |
| else | |
| before_sha="${{ github.event.before }}" | |
| after_sha="${GITHUB_SHA}" | |
| if [ "${before_sha}" = "0000000000000000000000000000000000000000" ]; then | |
| if git rev-parse "${after_sha}^" >/dev/null 2>&1; then | |
| range="${after_sha}^..${after_sha}" | |
| else | |
| range="${after_sha}..${after_sha}" | |
| fi | |
| else | |
| range="${before_sha}..${after_sha}" | |
| fi | |
| fi | |
| echo "range=${range}" >> "$GITHUB_OUTPUT" | |
| echo "Using commit range: ${range}" | |
| - name: Check commit subjects in range | |
| run: | | |
| python scripts/check_commit_message.py --range "${{ steps.commit_range.outputs.range }}" |