mirror of
https://github.com/hustcer/deepseek-review.git
synced 2026-05-13 05:16:05 +08:00
fix: Fix awk error on macOS runner (#71)
This commit is contained in:
4
.github/workflows/cr.yml
vendored
4
.github/workflows/cr.yml
vendored
@@ -8,7 +8,7 @@ on:
|
|||||||
- opened # Triggers when a PR is opened
|
- opened # Triggers when a PR is opened
|
||||||
- reopened # Triggers when a PR is reopened
|
- reopened # Triggers when a PR is reopened
|
||||||
- synchronize # Triggers when a commit is pushed to the PR
|
- synchronize # Triggers when a commit is pushed to the PR
|
||||||
# - labeled # Triggers when a label is added to the PR
|
# - labeled # Triggers when a label is added to the PR
|
||||||
|
|
||||||
# fix: GraphQL: Resource not accessible by integration (addComment) error
|
# fix: GraphQL: Resource not accessible by integration (addComment) error
|
||||||
permissions:
|
permissions:
|
||||||
@@ -16,7 +16,7 @@ permissions:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup-deepseek-review:
|
setup-deepseek-review:
|
||||||
runs-on: ubuntu-latest
|
runs-on: macos-latest
|
||||||
name: Code Review
|
name: Code Review
|
||||||
# Make sure the code review happens only when the PR has the label 'ai review'
|
# Make sure the code review happens only when the PR has the label 'ai review'
|
||||||
# if: contains(github.event.pull_request.labels.*.name, 'ai review')
|
# if: contains(github.event.pull_request.labels.*.name, 'ai review')
|
||||||
|
|||||||
18
nu/review.nu
18
nu/review.nu
@@ -196,17 +196,31 @@ export def get-diff [
|
|||||||
if ($content | is-empty) {
|
if ($content | is-empty) {
|
||||||
print $'(ansi g)Nothing to review.(ansi reset)'; exit $ECODE.SUCCESS
|
print $'(ansi g)Nothing to review.(ansi reset)'; exit $ECODE.SUCCESS
|
||||||
}
|
}
|
||||||
|
let awk_bin = (prepare-awk)
|
||||||
if ($include | is-not-empty) {
|
if ($include | is-not-empty) {
|
||||||
let patterns = $include | split row ','
|
let patterns = $include | split row ','
|
||||||
$content = $content | awk (generate-include-regex $patterns)
|
$content = $content | ^$awk_bin (generate-include-regex $patterns)
|
||||||
}
|
}
|
||||||
if ($exclude | is-not-empty) {
|
if ($exclude | is-not-empty) {
|
||||||
let patterns = $exclude | split row ','
|
let patterns = $exclude | split row ','
|
||||||
$content = $content | awk (generate-exclude-regex $patterns)
|
$content = $content | ^$awk_bin (generate-exclude-regex $patterns)
|
||||||
}
|
}
|
||||||
$content
|
$content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Prepare gawk for macOS
|
||||||
|
export def prepare-awk [] {
|
||||||
|
if (is-installed awk) {
|
||||||
|
print $'Current awk version: (awk --version | lines | first)'
|
||||||
|
}
|
||||||
|
if ($env.GITHUB_ACTIONS? != 'true') { return 'awk' }
|
||||||
|
if (sys host | get name) == 'Darwin' {
|
||||||
|
brew install gawk
|
||||||
|
print $'Current gawk version: (gawk --version | lines | first)'
|
||||||
|
}
|
||||||
|
'gawk'
|
||||||
|
}
|
||||||
|
|
||||||
# Compact the record by removing empty columns
|
# Compact the record by removing empty columns
|
||||||
export def compact-record []: record -> record {
|
export def compact-record []: record -> record {
|
||||||
let record = $in
|
let record = $in
|
||||||
|
|||||||
Reference in New Issue
Block a user