Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion scripts/bash/get-pr-context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ set -o pipefail
#==============================================================================

SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
if git rev-parse --show-toplevel >/dev/null 2>&1; then
REPO_ROOT="$(git rev-parse --show-toplevel)"
else
REPO_ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
fi

PR_NUMBER=""
JSON_MODE=false
Expand Down
13 changes: 9 additions & 4 deletions scripts/powershell/get-pr-context.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ $ErrorActionPreference = "Stop"
#==============================================================================

$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
$repoRoot = (Resolve-Path "$scriptPath\..\..")
$gitRoot = try { git rev-parse --show-toplevel 2>$null } catch { $null }
if ($LASTEXITCODE -eq 0 -and $gitRoot) {
$repoRoot = $gitRoot.Trim()
} else {
$repoRoot = (Resolve-Path "$scriptPath\..\..\..\").Path
}

#==============================================================================
# Utility Functions
Expand Down Expand Up @@ -170,16 +175,16 @@ if (-not $IncludeAllFiles -and $filesChangedTotal -gt $FileSampleLimit) {
}

# Check for constitution
$constitutionPath = Join-Path $repoRoot.Path ".documentation\memory\constitution.md"
$constitutionPath = Join-Path $repoRoot ".documentation\memory\constitution.md"
$constitutionExists = Test-Path $constitutionPath

# Prepare review directory
$reviewDir = Join-Path $repoRoot.Path ".documentation\specs\pr-review"
$reviewDir = Join-Path $repoRoot ".documentation\specs\pr-review"

# Build output
if ($Json) {
$output = @{
REPO_ROOT = $repoRoot.Path
REPO_ROOT = $repoRoot
PR_CONTEXT = @{
enabled = $true
pr_number = $prData.number
Expand Down
Loading