{"id":25932575,"url":"https://github.com/lusipad/azure-commitlog-check","last_synced_at":"2026-05-07T12:37:54.240Z","repository":{"id":280413552,"uuid":"941907952","full_name":"lusipad/Azure-Commitlog-Check","owner":"lusipad","description":"A tool for checking whether commit messages in Azure DevOps (TFS) Pull Requests comply with standards, especially suitable for PRs using squash commit method.","archived":false,"fork":false,"pushed_at":"2025-03-03T10:19:18.000Z","size":45,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-03T10:22:03.160Z","etag":null,"topics":["azure","commit","commit-log","log"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lusipad.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-03T08:57:33.000Z","updated_at":"2025-03-03T10:21:38.000Z","dependencies_parsed_at":"2025-03-03T10:22:08.802Z","dependency_job_id":"e3fc72ec-3fb1-48e0-9b86-3636d859fe0d","html_url":"https://github.com/lusipad/Azure-Commitlog-Check","commit_stats":null,"previous_names":["lusipad/azure-commitlog-check"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2FAzure-Commitlog-Check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2FAzure-Commitlog-Check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2FAzure-Commitlog-Check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lusipad%2FAzure-Commitlog-Check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lusipad","download_url":"https://codeload.github.com/lusipad/Azure-Commitlog-Check/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241763764,"owners_count":20016161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure","commit","commit-log","log"],"created_at":"2025-03-04T00:38:21.895Z","updated_at":"2026-05-07T12:37:54.109Z","avatar_url":"https://github.com/lusipad.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Azure-Commitlog-Check\n\n[English](README.md) | [中文](README.zh-CN.md)\n\nA tool for checking whether commit messages in Azure DevOps (TFS) Pull Requests comply with standards, especially suitable for PRs using squash commit method.\n\n## Key Features\n\n- Connect to Azure DevOps (TFS) services\n- Retrieve detailed information about specific PRs\n- Check if PR titles conform to commit message standards\n- Support custom commit message validation with regex patterns\n- Automatically detect the PR of the current branch without manual PR ID specification\n\n## Tech Stack\n\n- .NET 8.0\n- Azure DevOps API\n- System.CommandLine (command-line parsing)\n\n## Quick Start\n\n1. Clone the repository\n2. Build the project\n   ```powershell\n   cd Azure-Commitlog-Check\n   dotnet build\n   ```\n3. Run the check (two options):\n   \n   a. With auto-detection (recommended):\n   ```powershell\n   dotnet run -- --url \"https://dev.azure.com/yourorganization\" --token \"your-pat-token\" --project \"your-project\" --auto-detect\n   ```\n   \n   b. With manual PR ID:\n   ```powershell\n   dotnet run -- --url \"https://dev.azure.com/yourorganization\" --token \"your-pat-token\" --project \"your-project\" --pr-id 12345\n   ```\n\n## Command Parameters\n\n| Parameter    | Description                                      | Required |\n|--------------|--------------------------------------------------|----------|\n| --url        | Azure DevOps server URL                          | Yes      |\n| --token      | Personal Access Token (PAT)                      | Yes      |\n| --project    | Azure DevOps project name                        | Yes      |\n| --pr-id      | Pull Request ID (optional if --auto-detect used) | No       |\n| --repository | Repository name (for auto-detection)             | No       |\n| --auto-detect| Auto-detect PR of current branch                 | No       |\n| --pattern    | Regex pattern for validation                     | No       |\n| --quiet      | Only output final result                         | No       |\n\n## Regular Expression Customization and PR Merge Message Handling\n\n### Default Regular Expression\n\nThe tool uses the following regex pattern by default:\n```\n^(feat|fix|docs|style|refactor|perf|test|chore)(\\(.+\\))?: .{1,50}\n```\n\nThis pattern requires commit messages to follow this format:\n- Must start with a type: feat, fix, docs, style, refactor, perf, test, chore\n- Optional scope in parentheses, like feat(login)\n- Colon and space followed by 1-50 characters description\n\n### Customizing Regular Expression\n\nYou can customize the regex pattern using the `--pattern` parameter:\n\n```powershell\ndotnet run -- --url \"https://dev.azure.com/yourorganization\" --token \"your-pat-token\" --project \"your-project\" --pr-id 12345 --pattern \"^(feat|fix|custom)(\\(.+\\))?: .+\"\n```\n\n### Handling Automatic PR Merge Messages\n\nIf server auto-generated merge messages (like \"Merged PR 123: Title content\") don't comply with your commit standards, you can use a more permissive regex pattern:\n\n```powershell\n# Allow standard format or auto-merge PR format\ndotnet run -- --auto-detect --pattern \"^(feat|fix|docs|style|refactor|perf|test|chore)(\\(.+\\))?: .+|^Merged\\s+PR\\s+\\d+:.*\"\n```\n\nOr exclude specific PR checks (use only in special cases):\n\n```powershell\n# Skip check if PR title matches auto-merge format\nif ($prTitle -match \"^Merged\\s+PR\\s+\\d+:\") { exit 0 } else { azcommitcheck --auto-detect }\n```\n\n## Exit Codes\n\n| Code | Meaning                   | Typical Scenario                    |\n|------|---------------------------|-------------------------------------|\n| 0    | Success                   | All commits meet standards          |\n| 1    | Invalid Commit Message    | Commit message format is incorrect  |\n| 2    | PR Not Found              | Specified PR ID doesn't exist       |\n| 3    | No Commits                | PR has no commit records            |\n| 4    | API Error                 | Network issues/token expired        |\n| 5    | Git Not Found             | Missing Git environment variables   |\n| 6    | No PR For Branch          | Branch not associated with any PR   |\n\n## Azure DevOps Pipeline Integration\n\nThis tool can also be used as an Azure DevOps Pipeline extension, allowing you to automatically check commit messages in your CI/CD workflows.\n\n### Installing the Extension\n\n1. Install the \"Azure Commitlog Check\" extension from the [Azure DevOps Marketplace](https://marketplace.visualstudio.com/)\n   - Search for \"Azure Commitlog Check\"\n   - Click the \"Install\" button to add the extension to your organization\n\n2. Grant the necessary permissions for your pipelines\n   - Make sure to enable the \"Allow scripts to access OAuth token\" option in your pipeline settings\n\n### Developer Notes (For Extension Development Only)\n\nIf you want to modify or customize this extension, follow these steps:\n\n1. Build the project and copy the executable to the extension task folder\n   ```powershell\n   # Build the project\n   dotnet publish -c Debug -r win-x64 --self-contained false\n   \n   # Copy the executable to the extension task folder\n   copy Azure-Commitlog-Check\\bin\\Debug\\net8.0\\win-x64\\Azure-Commitlog-Check.exe Azure-Commitlog-Check\\extension\\task\\\n   ```\n\n2. Ensure there's an extension icon in the images directory\n   ```powershell\n   # Create images directory if it doesn't exist\n   mkdir -p Azure-Commitlog-Check\\extension\\images\n   \n   # Add an extension icon\n   # Example: copy your-icon.png Azure-Commitlog-Check\\extension\\images\\extension-icon.png\n   ```\n\n3. Package the extension\n   ```powershell\n   # Install the TFS Cross Platform Command Line Interface if you don't have it\n   npm install -g tfx-cli\n   \n   # Package the extension\n   cd Azure-Commitlog-Check\\extension\n   tfx extension create --manifest-globs vss-extension.json\n   ```\n\n4. Upload the generated .vsix file to the Azure DevOps Marketplace\n\n## Pipeline YAML Example\n\n```yaml\n# Example azure-pipelines.yml\ntrigger:\n- main\n- feature/*\n\npool:\n  vmImage: 'windows-latest'\n\nsteps:\n- checkout: self\n  fetchDepth: 0  # Required for PR auto-detection to work correctly\n  \n# Make sure to enable OAuth token access for this task\n- task: AzureCommitlogCheck@1\n  inputs:\n    autoDetect: true  # Auto-detect PR from current branch\n    # repository: 'MyRepository'  # Optional: specify if auto-detection has issues\n    pattern: '^(feat|fix|docs|style|refactor|perf|test|chore)(\\(.+\\))?: .{1,50}'  # Optional: customize pattern\n  env:\n    SYSTEM_ACCESSTOKEN: $(System.AccessToken)  # Required for API access\n```\n\n### Pipeline Configuration\n\n| Input Parameter | Description | Default |\n|-----------------|-------------|---------|\n| autoDetect      | Auto-detect PR of current branch | true |\n| pullRequestId   | Manual PR ID (ignored if autoDetect=true) | |\n| repository      | Repository name for auto-detection | Auto-detected from env |\n| pattern         | Regex pattern for validation | Standard pattern |\n\n### Required Pipeline Permissions\n\nFor the task to work correctly, you need to:\n\n1. Enable \"Allow scripts to access the OAuth token\" in the pipeline settings\n2. Grant sufficient permissions to the build service account to access Pull Request information\n\n![OAuth Settings](https://docs.microsoft.com/en-us/azure/devops/pipelines/build/media/options/allow-scripts-to-access-oauth-token.png?view=azure-devops)\n\n### Build Validation Policy\n\nThis task is ideal for use in build validation policies. To set up:\n\n1. Go to your repository settings\n2. Navigate to Policies \u003e Branch Policies\n3. Add a build validation policy and select your pipeline\n4. Configure the policy to run on PR creation/updates\n\n## Documentation\n\n## GitHub Flow \u0026 Automated Release\n\nThis project uses GitHub Flow and automated releases through GitHub Actions:\n\n- **Continuous Integration**: Automatically runs build and tests when Pull Requests are submitted to the master branch\n- **Automated Release**: When version tags (e.g., v1.0.0) are pushed, GitHub Actions will automatically:\n  - Build the project\n  - Create release packages for Windows, Linux, and macOS\n  - Publish a new GitHub Release with the packaged files\n\n## License\n\nThis project is licensed under the [MIT](LICENSE) License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusipad%2Fazure-commitlog-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flusipad%2Fazure-commitlog-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flusipad%2Fazure-commitlog-check/lists"}