From bbb1d7044616d4679a593e1d342f3a1db9fd21e8 Mon Sep 17 00:00:00 2001 From: Sergii Stotskyi Date: Sun, 29 Sep 2024 08:33:51 +0300 Subject: [PATCH] chore: hacks semantic-release to skip verification of write access to git repo --- packages/dx/bin/release-packages.sh | 2 +- packages/dx/bin/semantic-release | 13 +++++++++++++ packages/dx/lib/dx.js | 8 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100755 packages/dx/bin/semantic-release diff --git a/packages/dx/bin/release-packages.sh b/packages/dx/bin/release-packages.sh index 5fd8a2b82..7b262b7a0 100755 --- a/packages/dx/bin/release-packages.sh +++ b/packages/dx/bin/release-packages.sh @@ -33,7 +33,7 @@ ______HERE__ release_options="" if [ "$preview_branch" != "" ]; then - release_options=" --dry-run --no-ci --branches master,$preview_branch" + release_options=" --dry-run --verify-conditions false --no-ci --branches master,$preview_branch" fi echo "running: pnpm run -r $pnpm_options release $release_options" >> $GITHUB_STEP_SUMMARY pnpm run -r $pnpm_options release $release_options diff --git a/packages/dx/bin/semantic-release b/packages/dx/bin/semantic-release new file mode 100755 index 000000000..baf71d695 --- /dev/null +++ b/packages/dx/bin/semantic-release @@ -0,0 +1,13 @@ +#!/usr/bin/env node + + +const git = require('semantic-release/lib/git'); + +// overwrite semantic release verifyAuth function to be ignored in dry-run mode +const verifyAuth = git.verifyAuth; +git.verifyAuth = async (...args) => { + if (process.argv.includes('--dry-run')) return; + return verifyAuth(...args); +} + +require('semantic-release/bin/semantic-release.js'); diff --git a/packages/dx/lib/dx.js b/packages/dx/lib/dx.js index 52d2503f7..627e146ec 100644 --- a/packages/dx/lib/dx.js +++ b/packages/dx/lib/dx.js @@ -1,8 +1,14 @@ const fsPath = require('path'); +const fs = require('fs'); const { spawnAndExit } = require('./spawn'); const configPath = filename => fsPath.join(__dirname, '..', 'config', filename); -const localBin = cli => fsPath.join(__dirname, '..', 'node_modules', '.bin', cli); +const localBin = cli => { + const localReplacement = fsPath.join(__dirname, '..', 'bin', cli); + return fs.existsSync(localReplacement) + ? localReplacement + : fsPath.join(__dirname, '..', 'node_modules', '.bin', cli); +} const COMMANDS = { install() {