Skip to content

Commit 3557cc5

Browse files
authored
ci: update dry-run logic of git push (#45)
## Proposed changes Reviewed the `git push` command options and dry-run method to be consistent with branch protection rules. ## Types of changes [//]: # 'What types of changes does your code introduce to WebdriverIO?' [//]: # '_Put an `x` in the boxes that apply_' - [ ] Polish (an improvement for an existing feature) - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Documentation update (improvements to the project's docs) - [X] Internal updates (everything related to internal scripts, governance documentation and CI files) ## Checklist [//]: # "_Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code._" - [X] I have read the [CONTRIBUTING](https://github.com/webdriverio/vscode-webdriverio/blob/main/CONTRIBUTION.md) doc - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] I have added the necessary documentation (if appropriate) - [ ] I have added proper type definitions for new commands (if appropriate) ## Further comments [//]: # 'If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...' ### Reviewers: @webdriverio/project-committers
1 parent 99d3ae7 commit 3557cc5

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

infra/release/src/push.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ import shell from 'shelljs'
88

99
import pkg from '../../../lerna.json' with { type: 'json' }
1010

11-
if (process.env.VSCODE_WDIO_DRY_RUN === 'yes') {
12-
console.log('dryRun is `yes`. Skip the push.')
13-
process.exit(0)
11+
const dryRunArgs = process.env.VSCODE_WDIO_DRY_RUN === 'yes' ? ' --dry-run' : ''
12+
13+
function exec(command: string) {
14+
console.log(`> ${command}\n`)
15+
shell.exec(command)
1416
}
1517

16-
console.log('Pushing the commit and tag.')
17-
shell.exec('git push origin --no-verify')
18-
shell.exec(`git push origin refs/tags/v${pkg.version} -f --no-verify`)
19-
console.log('Successfully pushed.')
18+
console.log('Pushing the commit and tag.\n')
19+
exec(`git push origin --no-verify${dryRunArgs}`)
20+
exec(`git push origin refs/tags/v${pkg.version} --no-verify${dryRunArgs}`)
21+
console.log('\nSuccessfully pushed.\n')

0 commit comments

Comments
 (0)