tod 0.11.2

An unofficial Todoist command-line client
# This workflow checks for version consistency between the CHANGELOG.md and Cargo.toml files in a pull request. 
name: Release Check

on:
  pull_request:
    branches:
      - main
    types: [opened, synchronize, reopened, labeled, ready_for_review]

permissions:
  contents: read  # This grants read access specifically to the 'contents' scope

jobs:
  check-release-pr:
    name: Check Version in CHANGELOG and Cargo.toml
    # This job checks if the version in CHANGELOG.md matches the version in Cargo.toml.
    runs-on: ubuntu-latest

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v6

      - name: Check Version Consistency
        run: |
          # Extract version from CHANGELOG.md (matches: ## [0.8.0](...) or pre-releases like [1.0.0-rc.1])
          changelog_version=$(grep -E '^## \[[0-9]+\.[0-9]+\.[0-9]+([-+a-zA-Z0-9.]*)?' CHANGELOG.md | head -n 1 | sed -E 's/^## \[([0-9]+\.[0-9]+\.[0-9]+([-+a-zA-Z0-9.]*)?).*/\1/')
          echo "CHANGELOG.md version: ${changelog_version}"
          
          # Extract version from Cargo.toml (handles pre-releases too)
          cargo_version=$(grep '^version = "' Cargo.toml | head -n 1 | sed -E 's/version = "([0-9]+\.[0-9]+\.[0-9]+([-+a-zA-Z0-9.]*)?)"/\1/')
          echo "Cargo.toml version: ${cargo_version}"
          
          # Compare
          if [[ "${changelog_version}" == "${cargo_version}" ]]; then
            echo "✅ Version check passed"
          else
            echo "❌ Version mismatch between CHANGELOG.md and Cargo.toml"
            exit 1
          fi