Skip to content

Instantly share code, notes, and snippets.

@ThaiDat
ThaiDat / Azure DevOps PRs.m
Last active August 18, 2024 11:05
The Power BI Power Query M to fetch the Azure DevOps Pull Requests via its REST API. This is the source code for my technical blog post. For detail explanation, please visit: https://note.datengineer.dev/posts/how-to-create-azure-devops-pull-requests-reporting-with-power-bi/
let
Source = Json.Document(Web.Contents("https://dev.azure.com/"&_organization&"/"&_project&"/_apis/git/pullrequests?searchCriteria.includeLinks=true&searchCriteria.status=all&$top="&_top&"&api-version=7.1-preview.1")),
#"Converted to Table" = Table.FromRecords({Source}, {"value"}),
#"Expanded value" = Table.ExpandListColumn(#"Converted to Table", "value"),
#"Expanded value1" = Table.ExpandRecordColumn(
#"Expanded value",
"value",
{"repository", "pullRequestId", "codeReviewId", "status", "createdBy", "creationDate", "closedDate", "title", "description", "sourceRefName", "targetRefName", "mergeStatus", "isDraft", "mergeId", "reviewers", "labels", "url", "completionOptions", "supportsIterations", "completionQueueTime"},
{"value.repository", "value.pullRequestId", "value.codeReviewId", "value.status", "value.createdBy", "value.creationDate", "value.closedDate", "value.title", "value.description", "value.sourceRefName", "value.targetRefName", "value.mergeStatus", "v
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ThaiDat
ThaiDat / git-publish
Created July 14, 2023 05:25
Git extension to publish a new local branch to remote
#!/bin/sh
# Usage: pushes current checkout branch to remote
# Ex: git publish origin
if [ -z ${1+x} ] && [ $(git remote | wc -l) -eq 1 ]; then
remote=$(git remote)
else
remote=$1
fi
git push --set-upstream $remote $(git branch --show-current)
@ThaiDat
ThaiDat / clean.sh
Last active July 31, 2023 10:36
The highly-customizable fast-and-simple bash script that will do various text-processing operations on files in a certain directory. It is useful for code formatting at the repository level and can be used in continuous integration and deployment (CI/CD) pipelines.
# CL_FILE_EXTENSIONS: The script will apply on files with given extensions
if [ -z ${CL_FILE_EXTENSIONS+x} ]; then
CL_FILE_EXTENSIONS=(txt md json xml yaml yml sh bat)
fi
# CL_IGNORED_SUB_DIR: The script will ignore files in given directories
if [ -z ${CL_IGNORED_SUB_DIR+x} ]; then
CL_IGNORED_SUB_DIR=(.git)
fi