Skip to content

Commit

Permalink
Use exactlyOneOf to check instead
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo committed Dec 2, 2024
1 parent cbbb52f commit b2f7303
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ export async function run(): Promise<void> {
const useConnectGateway = parseBoolean(getInput('use_connect_gateway'));
const useDNSBasedEndpoint = parseBoolean(getInput('use_dns_based_endpoint'));

// Only one of use_internal_ip, use_connect_gateway, or use_dns_based_endpoint should be provided
if (useInternalIP && useConnectGateway && useDNSBasedEndpoint) {
// Only one of use_internal_ip, use_connect_gateway, or
// use_dns_based_endpoint should be provided.
if ([useInternalIP, useConnectGateway, useDNSBasedEndpoint].filter(Boolean).length > 1) {
throw new Error(
'The workflow must specify only one of `use_internal_ip`, `use_connect_gateway`, or `use_dns_based_endpoint`',
);
Expand Down

0 comments on commit b2f7303

Please sign in to comment.