Skip to content

Deno web service which can validate title of a pull request in Azure DevOps Services and inform it about pull request's validity.

License

Notifications You must be signed in to change notification settings

ecl1ps/tfs-pr-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

Azure DevOps PR Validator is a web service which can validate title of a pull request in Azure DevOps Services and inform it about pull request's validity.

Process overview

  1. User creates or updates pull request.
  2. Azure DevOps invokes Web Hook which sends information about pull request to validator app.
  3. Validator validates pull request and posts validation result through Azure DevOps REST Status API.
  4. Pull request page shows status's result and may enforce positive status requirement through Branch policies.

Install

  1. install Deno: https://deno.land/#installation
  2. [for development] install Denon: https://deno.land/x/denon#install
  3. [VS Code extension] install extension with id: denoland.vscode-deno

Bundle app (no build required)

deno bundle src/index.ts app.bundle.js

Run app

deno run --allow-net --allow-env app.bundle.js [<port>] or deno run [--cert <path to corporate CA PEM certificate>] --allow-net --allow-env app.bundle.js [<port>] in corporate environment

Configuration

Azure DevOps Authentication

API access token must be set in environment variable TFS_API_KEY. See https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate for instructions how to create PAT. Required token scope is just Code/Status.

Azure DevOps WebHook

In Azure DevOps go to Project Settings and create two new Service Hooks of type Web Hook triggered on: Pull request created and Pull request updated. Configure filters as per your needs. Set it to send HTTP request to: <validator IP or url>:<port (default is 8000)>/validate-pr/title.

Azure DevOps Branch Policies

In Azure DevOps go to Branch policy and add new requirement under Require approval from additional services with Status to check = tfs-pr-validator/title-validation.

About

Deno web service which can validate title of a pull request in Azure DevOps Services and inform it about pull request's validity.

Topics

Resources

License

Stars

Watchers

Forks