-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add poll-interval input #99
Add poll-interval input #99
Conversation
@@ -13,7 +13,7 @@ plugins: | |||
- jest | |||
parser: '@typescript-eslint/parser' | |||
parserOptions: | |||
project: ./tsconfig.json | |||
project: ./tsconfig.eslint.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same as tsconfig.json
with the exception of exclude: ['**/*.test.ts']
which fixes this error in test files:
Parsing error: ESLint was configured to run on `<tsconfigRootDir>/__tests__/main.test.ts` using `parserOptions.project`: <tsconfigRootDir>/../github-action-await-vercel/tsconfig.json
However, that TSConfig does not include this file.
(if you ever want to start running ESLint on the entire project)
@@ -2,3 +2,4 @@ | |||
coverage/ | |||
node_modules/ | |||
lib/ | |||
README.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might make sense to use Prettier to format the entire project, but I didn't want to bloat this diff.
It looks like my editor did remove some trailing spaces (which I'm happy to revert if you want).
/** Duration (in milliseconds) to wait for a terminal deployment status */ | ||
timeout: number; | ||
/** Duration (in milliseconds) to wait in between polled Vercel API requests */ | ||
pollInterval: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled this into a single object argument with named parameters, mostly to de-risk an ordering bug with passing in multiple number
arguments.
}, | ||
}) | ||
.then((data) => data.json()) | ||
.catch((error: string) => reject(error))) as VercelDeployment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we were await
ing for the promise, this didn't seem necessary. Errors thrown inside of executor function will inherently reject the promise.
headers: { | ||
Authorization: `Bearer ${process.env.VERCEL_TOKEN}`, | ||
}, | ||
retryOptions: { | ||
retryMaxDuration: timeout * 1000, // Convert seconds to milliseconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timeout
was actually already converted to milliseconds, so this would have been much too large. I actually helped review #97 but didn't catch this on my first pass 😓
The updated value adjusts for the remaining timeout duration in milliseconds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested on #100 |
@namoscato Your PR has been merged with main and released. Thank you! |
Resolves #95
Context
I work with @dlively1 and in addition to #97 retries, we thought it would be helpful to introduce a delay in between each Vercel API request in an effort to stay within their rate limits.
Summary
poll-interval
input, defaulting to 1 second (which will allow for about 8 concurrent executions of this GitHub Action)tsconfig.eslint.json
, which includes__tests__
directoryNODE_ENV=test
in sandboxedmain.test.ts
processaction.yml
configurationmillisecondsFromInput
utility functionretryMaxDuration
value