Skip to content

Commit 3702018

Browse files
committed
2 parents d804174 + c879b96 commit 3702018

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Graph-Editor/GraphEditorSupportScripts/Get-CommitHistory.ps1

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
# This script provides functions to retrieve commit history and merged pull requests from a GitHub repository,
2+
# targeting changes to Microsoft Graph API reference documentation files (api-reference/v1.0/api/).
3+
# It resolves the table-of-contents (TOC) location of each changed file from the microsoft-graph-docs-contrib repository.
4+
#
5+
# Prerequisites:
6+
# - A GitHub personal access token with "repo:status" and "public_repo" scopes.
7+
# SSO authorization for the MicrosoftDocs organization is required.
8+
# Obtain from: https://github.com/settings/tokens
9+
# - The "powershell-yaml" module (Install-Module -Name powershell-yaml -Scope CurrentUser)
10+
# - Call Connect-GitHubRepository before calling Get-CommitHistory or Get-CommitHistoryV2.
11+
#
12+
# Functions:
13+
# Connect-GitHubRepository - Stores the target GitHub organization, repository, and access token in global variables.
14+
# Get-CommitHistory - Retrieves commits pushed on the specified date and lists changed api-reference/v1.0/api/ files.
15+
# Filters out noise caused by bulk-merged old commits using a date-tolerance check.
16+
# Get-CommitHistoryV2 - Retrieves pull requests merged on the specified date and lists changed api-reference/v1.0/api/ files.
17+
# Recommended over Get-CommitHistory because it avoids bulk-merge noise by design.
18+
# Get-YamlContent - Fetches and parses a YAML file from a URL, with in-memory caching.
19+
# Search-FilenameInYaml - Searches the Microsoft Graph docs TOC YAML tree for the given filename and returns its location path(s).
20+
# Test-FileHasRecentCommits - Returns $true if any commit for a file has an author date within the tolerance window of the target date.
21+
# Invoke-GitHubApi - Calls the GitHub REST API with Bearer authentication and automatic exponential-backoff retry on rate-limit errors.
22+
#
23+
# Usage:
24+
# . .\Get-CommitHistory.ps1
25+
# Connect-GitHubRepository -Organization "microsoftgraph" -Repository "microsoft-graph-docs-contrib" -AccessToken "<token>"
26+
# Get-CommitHistoryV2 -Date (Get-Date "2024-01-15") # Recommended: PR-based
27+
# Get-CommitHistory -Date (Get-Date "2024-01-15") # Alternative: commit-based
28+
129
# Define a global variable to store the cache
230
$global:YamlCache = @{}
331

0 commit comments

Comments
 (0)