Skip to content

Commit 4ccba91

Browse files
committed
Remove repoPath setting
1 parent 2c8780e commit 4ccba91

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

__tests__/git.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ describe('Git commands', () => {
3737

3838
it('Verifies tag is returned if checked out on same commit', async () => {
3939
const cwd = await initTestRepo()
40+
process.chdir(cwd)
4041

4142
const settings = {} as Settings
4243
settings.gitPath = await io.which('git', true)
43-
settings.repoPath = cwd
4444
const g = new Git(settings)
4545

4646
await createAndCommitFile('first', 'First commit', cwd)
@@ -52,10 +52,10 @@ describe('Git commands', () => {
5252

5353
it('Verifies empty string is returned if no tag exists', async () => {
5454
const cwd = await initTestRepo()
55+
process.chdir(cwd)
5556

5657
const settings = {} as Settings
5758
settings.gitPath = await io.which('git', true)
58-
settings.repoPath = cwd
5959
const g = new Git(settings)
6060

6161
await createAndCommitFile('first', 'First commit', cwd)
@@ -66,10 +66,10 @@ describe('Git commands', () => {
6666

6767
it('Verifies empty string is returned if current tag does not match regex', async () => {
6868
const cwd = await initTestRepo()
69+
process.chdir(cwd)
6970

7071
const settings = {} as Settings
7172
settings.gitPath = await io.which('git', true)
72-
settings.repoPath = cwd
7373
settings.tagRegex = /[0-9]+\.[0-9]+\.[0-9]+.*/
7474
const g = new Git(settings)
7575

@@ -82,10 +82,10 @@ describe('Git commands', () => {
8282

8383
it('Verifies tag is returned if regex is matched', async () => {
8484
const cwd = await initTestRepo()
85+
process.chdir(cwd)
8586

8687
const settings = {} as Settings
8788
settings.gitPath = await io.which('git', true)
88-
settings.repoPath = cwd
8989
settings.tagRegex = /[0-9]+\.[0-9]+\.[0-9]+.*/
9090
const g = new Git(settings)
9191

@@ -98,10 +98,10 @@ describe('Git commands', () => {
9898

9999
it('Verifies previous tag is returned', async () => {
100100
const cwd = await initTestRepo()
101+
process.chdir(cwd)
101102

102103
const settings = {} as Settings
103104
settings.gitPath = await io.which('git', true)
104-
settings.repoPath = cwd
105105
settings.tagRegex = ''
106106
const g = new Git(settings)
107107

@@ -116,10 +116,10 @@ describe('Git commands', () => {
116116

117117
it('Verifies empty string is returned if no previous tag matches regex', async () => {
118118
const cwd = await initTestRepo()
119+
process.chdir(cwd)
119120

120121
const settings = {} as Settings
121122
settings.gitPath = await io.which('git', true)
122-
settings.repoPath = cwd
123123
settings.tagRegex = /[0-9]+\.[0-9]+\.[0-9]+.*/
124124
const g = new Git(settings)
125125

@@ -134,10 +134,10 @@ describe('Git commands', () => {
134134

135135
it('Verifies previous matching tag is found with invalid tag inbetween', async () => {
136136
const cwd = await initTestRepo()
137+
process.chdir(cwd)
137138

138139
const settings = {} as Settings
139140
settings.gitPath = await io.which('git', true)
140-
settings.repoPath = cwd
141141
settings.tagRegex = /[0-9]+\.[0-9]+\.[0-9]+.*/
142142
const g = new Git(settings)
143143

@@ -154,10 +154,10 @@ describe('Git commands', () => {
154154

155155
it('Verifies all commits are returned when no refs are specified', async () => {
156156
const cwd = await initTestRepo()
157+
process.chdir(cwd)
157158

158159
const settings = {} as Settings
159160
settings.gitPath = await io.which('git', true)
160-
settings.repoPath = cwd
161161
const g = new Git(settings)
162162

163163
await createAndCommitFile('first', 'First commit', cwd)
@@ -176,10 +176,10 @@ describe('Git commands', () => {
176176

177177
it('Verifies log if from ref is specified', async () => {
178178
const cwd = await initTestRepo()
179+
process.chdir(cwd)
179180

180181
const settings = {} as Settings
181182
settings.gitPath = await io.which('git', true)
182-
settings.repoPath = cwd
183183
const g = new Git(settings)
184184

185185
await createAndCommitFile('first', 'First commit', cwd)
@@ -197,10 +197,10 @@ describe('Git commands', () => {
197197

198198
it('Verifies log if to ref is specified', async () => {
199199
const cwd = await initTestRepo()
200+
process.chdir(cwd)
200201

201202
const settings = {} as Settings
202203
settings.gitPath = await io.which('git', true)
203-
settings.repoPath = cwd
204204
const g = new Git(settings)
205205

206206
await createAndCommitFile('first', 'First commit', cwd)
@@ -218,10 +218,10 @@ describe('Git commands', () => {
218218

219219
it('Verifies log with from and to refs specified', async () => {
220220
const cwd = await initTestRepo()
221+
process.chdir(cwd)
221222

222223
const settings = {} as Settings
223224
settings.gitPath = await io.which('git', true)
224-
settings.repoPath = cwd
225225
const g = new Git(settings)
226226

227227
await createAndCommitFile('first', 'First commit', cwd)
@@ -245,10 +245,10 @@ describe('Git commands', () => {
245245

246246
it('Verifies log does not contain commits matching regex', async () => {
247247
const cwd = await initTestRepo()
248+
process.chdir(cwd)
248249

249250
const settings = {} as Settings
250251
settings.gitPath = await io.which('git', true)
251-
settings.repoPath = cwd
252252
settings.filterRegex = /^\[skip\].*/
253253
const g = new Git(settings)
254254

src/git.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class Git {
8787

8888
const result = new GitOutput()
8989
const options = {
90-
cwd: this.settings.repoPath,
90+
cwd: process.cwd(),
9191
env,
9292
ignoreReturnCode: true,
9393
listeners: {

src/settings.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import * as io from '@actions/io'
44
export interface Settings {
55
// TODO: DOCS
66
gitPath: string
7-
repoPath: string
87
tagRegex: string | RegExp
98
filterRegex: string | RegExp
109
changelogFilePath: string
@@ -13,7 +12,6 @@ export interface Settings {
1312
export async function initSettings(): Promise<Settings> {
1413
const settings = {} as Settings
1514
settings.gitPath = await io.which('git', true)
16-
settings.repoPath = core.getInput('path') || '.'
1715
settings.tagRegex = core.getInput('tag-regex') || ''
1816
settings.filterRegex = core.getInput('filter-regex') || ''
1917
settings.changelogFilePath = core.getInput('changelog-file-path') || 'CHANGELOG.md'

0 commit comments

Comments
 (0)