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
9 changes: 9 additions & 0 deletions action.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const waitForUrl = async ({
vercelPassword,
protectionBypassHeader,
path,
allowUnauthenticated,
}) => {
const iterations = calculateIterations(
maxTimeout,
Expand Down Expand Up @@ -59,6 +60,12 @@ const waitForUrl = async ({
console.log(
`GET status: ${e.response.status}. Attempt ${i} of ${iterations}`
);

// If allowUnauthenticated is true and we get a 401, treat it as success
if (allowUnauthenticated && e.response.status === 401) {
console.log('Received 401 status code, treating as success due to allow_unauthenticated setting');
return;
}
} else if (e.request) {
console.log(
`GET error. A request was made, but no response was received. Attempt ${i} of ${iterations}`
Expand Down Expand Up @@ -291,6 +298,7 @@ const run = async () => {
const ENVIRONMENT = core.getInput('environment');
const MAX_TIMEOUT = Number(core.getInput('max_timeout')) || 60;
const ALLOW_INACTIVE = core.getBooleanInput('allow_inactive');
const ALLOW_UNAUTHENTICATED = core.getBooleanInput('allow_unauthenticated');
const PATH = core.getInput('path') || '/';
const CHECK_INTERVAL_IN_MS =
(Number(core.getInput('check_interval')) || 2) * 1000;
Expand Down Expand Up @@ -377,6 +385,7 @@ const run = async () => {
vercelPassword: VERCEL_PASSWORD,
protectionBypassHeader: VERCEL_PROTECTION_BYPASS_HEADER,
path: PATH,
allowUnauthenticated: ALLOW_UNAUTHENTICATED,
});
} catch (error) {
core.setFailed(error.message);
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ inputs:
description: 'The path to check. Defaults to the index of the domain'
default: '/'
required: false
allow_unauthenticated:
description: 'Allow unauthenticated access (401 errors) to be treated as success. Useful when deployment is complete but authentication is not configured.'
default: 'false'
required: false

outputs:
url:
Expand Down
Loading