Skip to content

Commit

Permalink
[auto-pr] Use regex instead of Starts|EndsWith (ScoopInstaller#3026)
Browse files Browse the repository at this point in the history
* [auto-pr] Use regex instead of Starts|EndsWith

On my end result of `hub status --porcelain -uno` is prefixed with space on left for some reason, 

![Auto-PR](https://i.imgur.com/3FKQZOg.png)

Alternatively $status could be Trimed before condition

![Trimed](https://i.imgur.com/1DRUlv4.png)

* Use x20
  • Loading branch information
Ash258 authored and r15ch13 committed Jan 23, 2019
1 parent 2e6cfc6 commit 0621db2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ hub diff --name-only | ForEach-Object {
execute "hub add $manifest"

# detect if file was staged, because it's not when only LF or CRLF have changed
$status = Invoke-Expression 'hub status --porcelain -uno'
$status = execute 'hub status --porcelain -uno'
$status = $status | Select-Object -First 1
if ($status -and $status.StartsWith('M ') -and $status.EndsWith("$app.json")) {
if ($status -and $status -match "^\x20*M\x20+.*$app.json") {
execute "hub commit -m '${app}: Update to version $version'"
} else {
Write-Host "Skipping $app because only LF/CRLF changes were detected ..." -ForegroundColor Yellow
Expand Down

0 comments on commit 0621db2

Please sign in to comment.