Skip to content
Merged
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
21 changes: 17 additions & 4 deletions .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
$PROJECT_NAME = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?name\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value
$CURRENT_VERSION = ($pyprojcontent | Select-String -Pattern '(?m)^\[(project|tool\.poetry)\][^\[]*?version\s*=\s*"([^"]*)"' -AllMatches).Matches[0].Groups[2].Value


# Get PR number and run number with proper padding
$PR_NUM = [int]"${{ github.event.pull_request.number }}"
$PADDED_PR = "{0:D5}" -f [int]"${{ github.event.pull_request.number }}"
Expand All @@ -59,9 +60,14 @@ jobs:

Write-Output "Package version set to $DEV_VERSION"

$startMarker = "<!-- DEV_PACKAGE_START -->"
$endMarker = "<!-- DEV_PACKAGE_END -->"

$dependencyMessage = @"
$startMarker
## Development Package

- Use ``uipath pack --nolock`` to get the latest dev build from this PR (requires version range).
- Add this package as a dependency in your pyproject.toml:

``````toml
Expand All @@ -82,7 +88,13 @@ jobs:

[tool.uv.sources]
$PROJECT_NAME = { index = "testpypi" }

[tool.uv]
override-dependencies = [
"$PROJECT_NAME>=$MIN_VERSION,<$MAX_VERSION",
]
``````
$endMarker
"@

# Get the owner and repo from the GitHub repository
Expand All @@ -100,10 +112,11 @@ jobs:
$pr = Invoke-RestMethod -Uri $prUri -Method Get -Headers $headers
$currentBody = $pr.body

# Check if there's already a development package section
if ($currentBody -match '## Development Package') {
# Replace the existing section with the new dependency message
$newBody = $currentBody -replace '## Development Package(\r?\n|.)*?(?=##|$)', $dependencyMessage
# Check if markers already exist in the PR description
$markerPattern = "(?s)$([regex]::Escape($startMarker)).*?$([regex]::Escape($endMarker))"
if ($currentBody -match $markerPattern) {
# Replace everything between markers (including markers)
$newBody = $currentBody -replace $markerPattern, $dependencyMessage
} else {
# Append the dependency message to the end of the description
$newBody = if ($currentBody) { "$currentBody`n`n$dependencyMessage" } else { $dependencyMessage }
Expand Down