Tool to sync work items and pull requests from Azure DevOps to Asana
Project description
ado-asana-sync
This project aims to synchronize work items and pull requests between Azure DevOps (ADO) and Asana. It's currently in development and not ready for use. Breaking changes will occur as needed.
Setup and Configuration
This guide covers everything you need to configure and run the sync tool, either locally for development or via Docker.
Prerequisites
- Python (if running locally): Install uv to manage dependencies and run the application.
- Docker (if running via containers): Install Docker and Docker Compose.
- Azure DevOps (ADO) PAT: A Personal Access Token with read access to Work Items, and Code (Read) access (which is required to sync pull requests).
- Asana PAT: A Personal Access Token with access to the target workspace and projects.
Configuration
The application requires environment variables and a project mapping file.
1. Environment Variables
Create a .env file in the root directory. You can copy the example file to get started:
cp .env.example .env
Required Variables:
ADO_PAT: Your Personal Access Token for Azure DevOps.ADO_URL: The full URL of your Azure DevOps instance (e.g.,https://dev.azure.com/your-org).ASANA_TOKEN: Your Personal Access Token for Asana.ASANA_WORKSPACE_NAME: The exact name of your Asana workspace.
Optional Variables:
CLOSED_STATES: Comma-separated ADO states considered closed (default:Closed,Removed,Done).THREAD_COUNT: Number of projects to sync in parallel (default:8).SLEEP_TIME: Seconds to sleep between sync runs (default:300).SYNC_THRESHOLD: Days to continue syncing closed tasks before unmapping (default:30).SYNCED_TAG_NAME: Asana tag appended to all synced items (default:synced).LOGLEVEL: Console log level (default:INFO).- See
.env.examplefor additional Application Insights telemetry configurations.
2. Project Mapping
The application needs to know which ADO teams map to which Asana projects. Create a projects.json file in the data/ directory:
cp data/projects.json.example data/projects.json
Mapping Structure:
[
{
"adoProjectName": "your-ado-project",
"adoTeamName": "Backend Team",
"asanaProjectName": "your-asana-project-backend"
}
]
adoProjectName: The name of your Azure DevOps project.adoTeamName: The specific team within the ADO project whose backlog you want to sync.asanaProjectName: The corresponding Asana project name.
Running the Application
You can run the sync tool either locally using uv or via Docker.
Option A: Running Locally (Development)
- Install dependencies:
uv sync - Run the application:
uv run python -m ado_asana_sync.sync
Option B: Running via Docker
The repository includes a compose.yml file for easy deployment.
- Build and start the container:
docker compose up --build
To run in the background, append -d to the command. The container will automatically pick up your .env file and mount the data/projects.json configuration.
Verifying the Setup
Once running, the application will:
- Connect to Azure DevOps and Asana to validate credentials.
- Read the
data/projects.jsonmapping. - Begin synchronizing active work items and pull requests based on the mapping.
- Output logs indicating the sync progress.
You can verify the first sync by checking your mapped Asana project for newly created tasks with the configured synced tag.
Features
Work Item Synchronization
- Synchronizes Azure DevOps work items (User Stories, Bugs, Tasks, etc.) to Asana tasks
- Maintains bidirectional sync for updates, assignments, and status changes
- Automatic user matching between ADO and Asana based on email addresses
- Configurable closed states mapping
Pull Request Synchronization
- Synchronizes active Pull Requests from Azure DevOps to Asana
- Creates separate reviewer tasks for each assigned reviewer
- Task titles follow the format: "Pull Request 5: Update readme (Reviewer Name)"
- Automatic status management:
- Approved reviews (approve/approve with suggestions) → Close Asana task
- Other review states (waiting for author, reject, no vote) → Keep task open
- PR completion/abandonment → Close all reviewer tasks
- Reviewer removal → Close reviewer's task
- Handles reviewer additions, removals, and approval resets
- Syncs PR title changes to Asana task titles
Pull Request Selection Logic
The system follows this logic to determine which PRs to sync:
- Repository Discovery: For each configured ADO project, discover all Git repositories
- Active PR Filtering: Query only PRs with
status="active"(excludes completed/abandoned PRs) - Reviewer Requirements: Only sync PRs that have at least one assigned reviewer
- User Matching: Only create tasks for reviewers who have matching Asana accounts (by email)
- Deduplication: Prevent duplicate reviewer processing by unique email identifier
- Cleanup Processing: Additionally process previously synced PRs that may now be closed/completed
Exclusion Criteria:
- PRs without reviewers are skipped (logs: "No reviewers found for PR X")
- Reviewers not found in Asana are skipped (logs: "PR X: reviewer Y not found in Asana")
- Repositories/projects without Git API access are skipped gracefully
Changelog
See CHANGELOG.md for a detailed history of changes and new features.
Development
Commit message style
This repo uses Conventional Commits to ensure the build numbering is generated correctly
Manual testing
To test the application manually, you can use the following steps:
Work Item Testing
- Create new ADO work item and ensure it is synced to Asana.
- Rename Asana task and ensure it is reverted back to the ADO name.
- Rename ADO task and ensure it is synced to Asana.
- Remove Synced tag from item in Asana and ensure it is replaced.
- Delete synced tag from Asana workspace and from appdata.json file and ensure it is re-created and assigned to all synced tasks.
- Mark Asana task as complete and ensure it is re-opened.
- Mark ADO task as complete and ensure it is marked as complete in Asana.
- Re-open ADO task and ensure it is re-opened in Asana.
Pull Request Testing
- Create new Pull Request in ADO with reviewers and ensure reviewer tasks are created in Asana.
- Change the PR title in ADO and ensure the title updates in Asana tasks on next sync.
- Add a reviewer to the PR and ensure a new task is created for them.
- Remove a reviewer from the PR and ensure their task is closed.
- Remove all reviewers from the PR and ensure all tasks are closed.
- Approve the PR as a reviewer and ensure the reviewer's task is closed.
- Approve with suggestions and ensure the reviewer's task is closed.
- Reject or request changes and ensure the reviewer's task remains open.
- Reset approval and ensure the reviewer's task is reopened.
- Complete/abandon the PR and ensure all reviewer tasks are closed.
Reference
ADO
Asana
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ado_asana_sync-1.26.11.tar.gz.
File metadata
- Download URL: ado_asana_sync-1.26.11.tar.gz
- Upload date:
- Size: 156.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105f6406ca5a72c495c0096a49c2bc7cdfc9347be54a6b2f74e14a9ef76172d6
|
|
| MD5 |
a528c1b0b501b27913c14a35965b333c
|
|
| BLAKE2b-256 |
1f430e732801747600f78bae4df63a7f596acaa4b0c58ca6d9c536013d221af4
|
Provenance
The following attestation bundles were made for ado_asana_sync-1.26.11.tar.gz:
Publisher:
release.yml on danstis/ado-asana-sync
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ado_asana_sync-1.26.11.tar.gz -
Subject digest:
105f6406ca5a72c495c0096a49c2bc7cdfc9347be54a6b2f74e14a9ef76172d6 - Sigstore transparency entry: 1185818924
- Sigstore integration time:
-
Permalink:
danstis/ado-asana-sync@cbff91b58994db1856a8fd3a127862e38c1e22d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/danstis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cbff91b58994db1856a8fd3a127862e38c1e22d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ado_asana_sync-1.26.11-py3-none-any.whl.
File metadata
- Download URL: ado_asana_sync-1.26.11-py3-none-any.whl
- Upload date:
- Size: 48.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
994e4392ae7dcbbb423dffd1110fcc0e49afafd655bd77627cd5a41acc18aea4
|
|
| MD5 |
c004701e5fe4644588069a8e523311fd
|
|
| BLAKE2b-256 |
f24c85e30aa2e88927855cdcb119a2906313928a2e0e439441ace9835777e400
|
Provenance
The following attestation bundles were made for ado_asana_sync-1.26.11-py3-none-any.whl:
Publisher:
release.yml on danstis/ado-asana-sync
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ado_asana_sync-1.26.11-py3-none-any.whl -
Subject digest:
994e4392ae7dcbbb423dffd1110fcc0e49afafd655bd77627cd5a41acc18aea4 - Sigstore transparency entry: 1185818928
- Sigstore integration time:
-
Permalink:
danstis/ado-asana-sync@cbff91b58994db1856a8fd3a127862e38c1e22d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/danstis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@cbff91b58994db1856a8fd3a127862e38c1e22d8 -
Trigger Event:
push
-
Statement type: