Skip to content

Commit

Permalink
feat: remove PR on test success
Browse files Browse the repository at this point in the history
change pullrequest to pull-request
change pullRequest (json) to pullRequest
  • Loading branch information
ghinks committed Apr 12, 2021
1 parent ac689bb commit a9f028d
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .wiby.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"repository": "git+https://github.com/wiby-test/pass"
}
],
"pullrequest": false
"pullRequest": false
}
4 changes: 2 additions & 2 deletions bin/commands/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports.builder = (yargs) => yargs
type: 'string',
conflicts: 'config'
})
.option('pullrequest', {
.option('pull-request', {
desc: 'close a draft PR created in the test phase',
alias: 'pr',
type: 'boolean',
Expand All @@ -25,7 +25,7 @@ exports.handler = async (params) => {
const config = params.dependent
? {
dependents: [{ repository: params.dependent }],
pullrequest: !!params.pullrequest
pullRequest: !!params['pull-request']
}
: wiby.validate({ config: params.config })

Expand Down
4 changes: 2 additions & 2 deletions bin/commands/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports.builder = (yargs) => yargs
type: 'string',
conflicts: 'config'
})
.option('pullrequest', {
.option('pull-request', {
desc: 'Raise a draft PR in addition to creating a branch',
alias: 'pr',
type: 'boolean',
Expand All @@ -25,7 +25,7 @@ exports.handler = (params) => {
const config = params.dependent
? {
dependents: [{ repository: params.dependent }],
pullrequest: !!params.pullrequest
pullRequest: !!params['pull-request']
}
: wiby.validate({ config: params.config })

Expand Down
2 changes: 1 addition & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const dependentSchema = joi.object({

exports.schema = joi.object({
dependents: joi.array().items(dependentSchema),
pullrequest: joi.boolean().optional()
pullRequest: joi.boolean().optional()

}).unknown(false)

Expand Down
2 changes: 1 addition & 1 deletion lib/result.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const pipelineStatusesEnum = module.exports.pipelineStatusesEnum = Object.freeze

const PENDING_RESULT_EXIT_CODE = 64

module.exports = async function ({ dependents, pullrequest }) {
module.exports = async function ({ dependents, pullRequest }) {
const parentPkgJSON = await context.getLocalPackageJSON()
const parentPkgInfo = gitURLParse(parentPkgJSON.repository.url)
const output = { status: pipelineStatusesEnum.PENDING, results: [] }
Expand Down
4 changes: 2 additions & 2 deletions lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const logger = require('./logger')
const testCommandNamespace = 'wiby:test'
const debug = logger(testCommandNamespace)

module.exports = async function ({ dependents, pullrequest }) {
module.exports = async function ({ dependents, pullRequest }) {
// enable log output for test command without DEBUG env
logger.enableLogs(testCommandNamespace)

Expand All @@ -32,7 +32,7 @@ module.exports = async function ({ dependents, pullrequest }) {

const patchedPackageJSON = applyPatch(parentDependencyLink, parentPkgJSON.name, dependentPkgJson, parentPkgJSON.name)
await pushPatch(patchedPackageJSON, dependentRepositoryInfo.owner, dependentRepositoryInfo.name, parentPkgJSON.name, parentBranchName)
if (pullrequest) {
if (pullRequest) {
await createPR(dependentRepositoryInfo.owner, dependentRepositoryInfo.name, parentBranchName, parentDependencyLink)
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/cli/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tap.test('test command', async (tap) => {
})

tap.test('test command should call test module with dependent URI', async (tap) => {
const result = childProcess.execSync(`${wibyCommand} test --dependent="https://github.com/wiby-test/fakeRepo" --pullrequest=true`, {
const result = childProcess.execSync(`${wibyCommand} test --dependent="https://github.com/wiby-test/fakeRepo" --pull-request=true`, {
env: {
...process.env,
NODE_OPTIONS: `-r ${fixturesPath}/http/test-command-positive.js`
Expand Down
2 changes: 1 addition & 1 deletion test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tap.test('config validation', async (tap) => {
repository: 'git+https://github.com/wiby-test/pass'
}
],
pullrequest: false
pullRequest: false
})
tap.end()
})
Expand Down

0 comments on commit a9f028d

Please sign in to comment.