Skip to content

Commit

Permalink
feat: check for 200 status code if no expected content is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
fhp committed Nov 25, 2024
1 parent 2878fc9 commit 34a9d2e
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ async function run(): Promise<void> {
const expectedContent: string = core.getInput('expectedContent');

console.log(`Polling url ${url} for ${attempts} attempts with a delay of ${interval}`);
console.log(`Awaiting specified content: ${expectedContent}`);
if (expectedContent) {
console.log(`Awaiting specified content: ${expectedContent}`);
}

let currentAttempt = 1;

Expand All @@ -25,9 +27,16 @@ async function run(): Promise<void> {
continue; // skip rest of current iteration
}

if (String(response?.data) === expectedContent) {
console.log('expected content found... proceeding');
process.exit(0);
if (expectedContent) {
if (String(response?.data) === expectedContent) {
console.log('expected content found... proceeding');
process.exit(0);
}
} else {
if (response?.status === 200) {
console.log('expected status code found... proceeding');
process.exit(0);
}
}

console.log(
Expand Down

0 comments on commit 34a9d2e

Please sign in to comment.