This script checks all pull requests across multiple repositories in an Azure DevOps project and reports those without associated work items.
- Scans multiple repositories in one run
- Creates a beautiful markdown report with tables
- Provides a summary of PRs missing work items
- Easy to configure with environment variables
You'll need these packages:
requests- For making API calls to Azure DevOpspython-dotenv- For loading environment variablesbase64- For encoding authentication (built-in)datetime- For timestamping reports (built-in)
Install required packages:
## βοΈ Configuration
Create a `.env` file with the following variables:
```ini
# Azure DevOps credentials
AZURE_ORGANIZATION=yourorganization
AZURE_PROJECT=yourproject
AZURE_PAT=yourpersonalaccesstoken
# Repository IDs
REPO_NAME_1=repository-guid-1
REPO_NAME_2=repository-guid-2
# Add more repositories as needed- Go to Azure DevOps and click on your profile icon in the top right
- Select "Personal access tokens"
- Click "New Token"
- Give it a name like "PR Work Item Checker"
- Set the organization where you want to use this token
- For minimum permissions, select:
- Custom defined
- Under "Code", select "Read"
- Set an expiration date
- Click "Create"
- Copy the token and add it to your
.envfile
Make sure your .env file is set up with all required variables.
Run the script from your terminal:
python pr_checker.pyThe markdown report includes:
- A timestamp of when it was generated
- Results for each repository
- A table of PRs without work items (if any)
- A summary with counts per repository
- Total count of PRs missing work items