Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions packages/devtools-evm-hardhat/src/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,25 @@ const action: ActionType<TaskArgs> = async (
error == null ? [] : [{ networkName, error }]
)

// We count the total number of contracts that were deployed across all networks
const totalDeployedContracts = Object.values(results).reduce(
(acc, { contracts }) => acc + (contracts ? Object.keys(contracts).length : 0),
0
)

// If tags were specified but no contracts were deployed, warn the user
// This could happen if the tag doesn't match any deploy scripts, or if all matching contracts are already deployed
if (selectedTags.length > 0 && totalDeployedContracts === 0 && errors.length === 0) {
logger.warn(
`${printBoolean(false)} No contracts were deployed. This could mean no deploy scripts matched the given ${pluralizeNoun(selectedTags.length, 'tag', 'tags')} (${selectedTags.join(', ')}), or the contracts are already deployed`
)

// Mark the process as unsuccessful
process.exitCode = process.exitCode || 1

return results
}

// If nothing went wrong we just exit
if (errors.length === 0) {
return logger.info(`${printBoolean(true)} Your contracts are now deployed`), results
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ expect "Do you want to continue?"
send -- "\r"

expect "Deploying..."
expect "Your contracts are now deployed"
expect "No contracts were deployed"

expect eof