ghreview 3.0.37 → 3.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/depsound.yml +2 -2
- package/CHANGELOG.md +13 -0
- package/lib/git.js +6 -13
- package/package.json +3 -3
- package/test/git.test.js +41 -0
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
permissions:
|
|
21
21
|
contents: read # diff the PR's manifests; this job never sees a write token
|
|
22
22
|
steps:
|
|
23
|
-
- uses: rvagg/depsound-action@
|
|
23
|
+
- uses: rvagg/depsound-action@49940d1f04828a01799cc129f3930d9bd42bceda # v0.5.0
|
|
24
24
|
post:
|
|
25
25
|
needs: review
|
|
26
26
|
if: ${{ always() && needs.review.result != 'cancelled' }} # a failed review still posts its failure marker
|
|
@@ -30,4 +30,4 @@ jobs:
|
|
|
30
30
|
checks: write # set the neutral check
|
|
31
31
|
actions: read # download the report artifact
|
|
32
32
|
steps:
|
|
33
|
-
- uses: rvagg/depsound-action/post@
|
|
33
|
+
- uses: rvagg/depsound-action/post@49940d1f04828a01799cc129f3930d9bd42bceda # v0.5.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [3.0.39](https://github.com/rvagg/ghreview/compare/v3.0.38...v3.0.39) (2026-11-02)
|
|
2
|
+
|
|
3
|
+
### Trivial Changes
|
|
4
|
+
|
|
5
|
+
* **deps:** update simple-git@4 ([#101](https://github.com/rvagg/ghreview/issues/101)) ([e8111ae](https://github.com/rvagg/ghreview/commit/e8111ae9d290a7b6aeec049ec374dfaa255b58e0))
|
|
6
|
+
|
|
7
|
+
## [3.0.38](https://github.com/rvagg/ghreview/compare/v3.0.37...v3.0.38) (2026-11-02)
|
|
8
|
+
|
|
9
|
+
### Trivial Changes
|
|
10
|
+
|
|
11
|
+
* **deps-dev:** bump vitest from 4.1.10 to 5.0.5 ([#98](https://github.com/rvagg/ghreview/issues/98)) ([50abb8d](https://github.com/rvagg/ghreview/commit/50abb8dbb95a691858b8584c0e4d37b2ffe8cf60))
|
|
12
|
+
* **deps:** bump the github-actions-minor-patch group with 2 updates ([#100](https://github.com/rvagg/ghreview/issues/100)) ([9f6c0de](https://github.com/rvagg/ghreview/commit/9f6c0de92a7e4651765eec870f73fa75a28b9079))
|
|
13
|
+
|
|
1
14
|
## [3.0.37](https://github.com/rvagg/ghreview/compare/v3.0.36...v3.0.37) (2026-11-02)
|
|
2
15
|
|
|
3
16
|
### Trivial Changes
|
package/lib/git.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import simpleGit from 'simple-git'
|
|
1
|
+
import { simpleGit } from 'simple-git'
|
|
2
2
|
|
|
3
3
|
export async function getCurrentBranch () {
|
|
4
4
|
const git = simpleGit()
|
|
@@ -21,7 +21,10 @@ export async function hasReviewableChanges ({ all = false } = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export async function createReviewCommit (message, authorConfig, { all = false } = {}) {
|
|
24
|
-
const
|
|
24
|
+
const { name, email } = authorConfig ?? {}
|
|
25
|
+
// user.name and user.email set both author and committer
|
|
26
|
+
const config = name && email ? [`user.name=${name}`, `user.email=${email}`] : []
|
|
27
|
+
const git = simpleGit({ config })
|
|
25
28
|
|
|
26
29
|
if (all) {
|
|
27
30
|
await git.add('.')
|
|
@@ -30,17 +33,7 @@ export async function createReviewCommit (message, authorConfig, { all = false }
|
|
|
30
33
|
await git.add(['-u'])
|
|
31
34
|
}
|
|
32
35
|
|
|
33
|
-
|
|
34
|
-
const env = {}
|
|
35
|
-
if (authorConfig?.name && authorConfig?.email) {
|
|
36
|
-
env.GIT_AUTHOR_NAME = authorConfig.name
|
|
37
|
-
env.GIT_AUTHOR_EMAIL = authorConfig.email
|
|
38
|
-
env.GIT_COMMITTER_NAME = authorConfig.name
|
|
39
|
-
env.GIT_COMMITTER_EMAIL = authorConfig.email
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Create commit with optional custom author
|
|
43
|
-
await git.env(env).commit(message)
|
|
36
|
+
await git.commit(message)
|
|
44
37
|
}
|
|
45
38
|
|
|
46
39
|
export async function pushBranch (remote, branch) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghreview",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.39",
|
|
4
4
|
"description": "GitHub PR-based code review workflow for AI-assisted development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"chalk": "^6.0.0",
|
|
29
29
|
"ghauth": "^7.0.0",
|
|
30
30
|
"ora": "^9.0.0",
|
|
31
|
-
"simple-git": "^
|
|
31
|
+
"simple-git": "^4.0.2",
|
|
32
32
|
"yargs": "^18.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"conventional-changelog-conventionalcommits": "^9.3.1",
|
|
42
42
|
"nock": "^15.0.5",
|
|
43
43
|
"standard": "^17.1.2",
|
|
44
|
-
"vitest": "^
|
|
44
|
+
"vitest": "^5.0.5"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|
package/test/git.test.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
|
2
|
+
import { execFileSync } from 'node:child_process'
|
|
3
|
+
import { mkdtemp, rm, appendFile } from 'node:fs/promises'
|
|
4
|
+
import { tmpdir } from 'node:os'
|
|
5
|
+
import { join } from 'node:path'
|
|
6
|
+
import { createReviewCommit } from '../lib/git.js'
|
|
7
|
+
|
|
8
|
+
const run = (dir, ...args) => execFileSync('git', args, { cwd: dir, encoding: 'utf8' }).trim()
|
|
9
|
+
|
|
10
|
+
describe('createReviewCommit', () => {
|
|
11
|
+
let dir
|
|
12
|
+
|
|
13
|
+
beforeEach(async () => {
|
|
14
|
+
dir = await mkdtemp(join(tmpdir(), 'ghreview-git-'))
|
|
15
|
+
run(dir, 'init', '-q')
|
|
16
|
+
run(dir, 'config', 'user.name', 'Local User')
|
|
17
|
+
run(dir, 'config', 'user.email', 'local@example.com')
|
|
18
|
+
await appendFile(join(dir, 'file.txt'), 'one\n')
|
|
19
|
+
run(dir, 'add', 'file.txt')
|
|
20
|
+
run(dir, 'commit', '-q', '-m', 'initial')
|
|
21
|
+
await appendFile(join(dir, 'file.txt'), 'two\n')
|
|
22
|
+
vi.spyOn(process, 'cwd').mockReturnValue(dir)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
afterEach(async () => {
|
|
26
|
+
vi.restoreAllMocks()
|
|
27
|
+
await rm(dir, { recursive: true, force: true })
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const identity = () => run(dir, 'log', '-1', '--format=%an <%ae>|%cn <%ce>|%s')
|
|
31
|
+
|
|
32
|
+
it('commits as the configured author and committer', async () => {
|
|
33
|
+
await createReviewCommit('review', { name: 'AI Assistant', email: 'ai@example.com' })
|
|
34
|
+
expect(identity()).toBe('AI Assistant <ai@example.com>|AI Assistant <ai@example.com>|review')
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it('commits with the git identity when no author is configured', async () => {
|
|
38
|
+
await createReviewCommit('review')
|
|
39
|
+
expect(identity()).toBe('Local User <local@example.com>|Local User <local@example.com>|review')
|
|
40
|
+
})
|
|
41
|
+
})
|