...
1
2# cSpell:ignore Committish
3# cSpell:ignore committish
4# cSpell:ignore PULLREQUEST
5# cSpell:ignore TARGETBRANCH
6# cSpell:ignore SOURCECOMMITID
7# cSpell:ignore elete
8# cSpell:ignore ename
9<#
10 .SYNOPSIS
11 Returns git diff changes in pull request.
12 .DESCRIPTION
13 The script is to return diff changes in pull request.
14 .PARAMETER SourceCommittish
15 The branch committish PR merges from.
16 Definition of committish: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefcommit-ishacommit-ishalsocommittish
17 .PARAMETER TargetCommittish
18 The branch committish PR targets to merge into.
19 .PARAMETER DiffPath
20 The files which git diff to scan against. Support regex match. E.g. "eng/common/*", "*.md"
21 .PARAMETER DiffFilterType
22 The filter type A(a)dd, D(d)elete, R(r)ename, U(u)pate.
23 E.g. 'ad' means filter out the newly added file and deleted file
24 E.g. '' means no filter on file mode.
25#>
26[CmdletBinding()]
27param (
28 [string] $SourceCommittish = "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}",
29 [string] $TargetCommittish = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/"),
30 [string] $DiffPath = "",
31 [string] $DiffFilterType = 'd'
32)
33
34Set-StrictMode -Version 3
35. (Join-Path $PSScriptRoot common.ps1)
36
37return Get-ChangedFiles -SourceCommittish $SourceCommittish `
38-TargetCommittish $TargetCommittish `
39-DiffPath $DiffPath `
40-DiffFilterType $DiffFilterType
View as plain text