Skip to content

Instantly share code, notes, and snippets.

View mdailey77's full-sized avatar

Matthew Dailey mdailey77

View GitHub Profile
@mdailey77
mdailey77 / removeoldnpmpackages.ps1
Created April 9, 2022 12:38
Remove all stored npm packages from Azure Artifacts
<# Azure DevOps REST API #>
$url1 = 'https://feeds.dev.azure.com/{organization}/_apis/packaging/Feeds/{feed_id}/packages?protocolType=npm&includeAllVersions=true&api-version=7.1-preview.1'
$Token = '{Personal_Access_Token}'
if ($Token -eq "") {
Write-Host 'PAT not set'
exit 1
}
$AzureAuthHeader1 = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", $Token)))
@mdailey77
mdailey77 / pre-push
Created April 9, 2022 13:38
Git pre-push hook to enforce branch naming conventions
#!/usr/bin/env bash
LC_ALL=C
local_branch="$(git rev-parse --abbrev-ref HEAD)"
valid_branch_regex="^(task|master|develop|qa|tb|bug|story)[a-z0-9._-]{2,10}$"
message="This branch violates the branch naming rules. Please rename your branch."
if [[ ! $local_branch =~ $valid_branch_regex ]]
@mdailey77
mdailey77 / getworkitemqueryids.ps1
Created August 13, 2022 20:10
An easy way to retrieve all the IDs of work item queries in a given Azure DevOps project
<# Azure DevOps REST API #>
$url = 'https://dev.azure.com/{organization_name}/{project_name}/_apis/wit/queries?$expand=all&$depth=2&$includeDeleted=false&api-version=7.1-preview.2'
$Token = '{Azure DevOps PAT}'
if ($Token -eq "") {
Write-Host 'PAT not set'
exit 1
}
$AzureAuthHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", $Token)))
@mdailey77
mdailey77 / getcurrentiteration.ps1
Created August 13, 2022 20:15
Gets information on the current project iteration in Azure Boards
<# Azure DevOps REST API #>
$url = 'https://dev.azure.com/{organization_name}/{project_name}/_apis/work/teamsettings/iterations?$timeframe=current&api-version=7.1-preview.1'
$Token = '{Azure DevOps PAT}'
if ($Token -eq "") {
Write-Host 'PAT not set'
exit 1
}
$AzureAuthHeader = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", $Token)))
[user]
email =
name =
username =
[web]
browser = google-chrome
[core]
editor = code --wait