Skip to content

Commit

Permalink
chore: brighten color
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetherinox committed Oct 16, 2024
1 parent b8a9cbd commit 3f2e5b0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ test.serial( ' Successfully remove multiple deployments only and not remove envi

console.log( `\n` )
for ( let i = 1; i <= deployAmt; i++ )
{
{
await createDeploymentWithStatus( octokit, environment, { ...context, ref } )
console.log( ` › ➕ Create test deployment for multitest › \x1b[38;5;13mref ${ ref }\x1b[0m` )
await delay( delayAmt )
Expand Down Expand Up @@ -456,7 +456,7 @@ test.serial( ' Successfully deleted limited results',

console.log( `\n` )
for ( let i = 1; i <= deployAmt; i++ )
{
{
await createDeploymentWithStatus( octokit, environment, { ...context, ref } )
console.log( ` › ➕ Create test deployment for multitest › \x1b[38;5;13mref ${ ref }\x1b[0m` )
await delay( delayAmt )
Expand Down
7 changes: 5 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ function listDeployments(client, { owner, repo, environment, ref = '', limit = 1
return deploymentRefs.concat(yield listDeployments(client, { owner, repo, environment, ref, limit }, page + 1));
}
}
else if (limit !== 100) {
(0, core_1.info)(` › ⚙️ Using custom limit of \x1b[38;5;1m${limit}\x1b[0m › not using pagination`);
}
/*
Done getting items, return deployment list
*/
Expand All @@ -100,7 +103,7 @@ function listDeployments(client, { owner, repo, environment, ref = '', limit = 1
*/
function setDeploymentInactive(client, { owner, repo, deploymentId }) {
return __awaiter(this, void 0, void 0, function* () {
(0, core_1.info)(` › ✔️ ID \x1b[38;5;8m${deploymentId}\x1b[0m inactive`);
(0, core_1.info)(` › ✔️ ID \x1b[38;5;244m${deploymentId}\x1b[0m inactive`);
yield client.request('POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses', {
owner,
repo,
Expand All @@ -114,7 +117,7 @@ function setDeploymentInactive(client, { owner, repo, deploymentId }) {
*/
function deleteDeploymentById(client, { owner, repo, deploymentId }) {
return __awaiter(this, void 0, void 0, function* () {
(0, core_1.info)(` › ✔️ ID \x1b[38;5;8m${deploymentId}\x1b[0m deleted`);
(0, core_1.info)(` › ✔️ ID \x1b[38;5;244m${deploymentId}\x1b[0m deleted`);
yield client.request('DELETE /repos/{owner}/{repo}/deployments/{deployment_id}', {
owner,
repo,
Expand Down
7 changes: 5 additions & 2 deletions lib/execute.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/execute.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions src/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async function listDeployments( client: Octokit, { owner, repo, environment, ref
const itemsTotal = deploymentRefs.length

if ( !limit || limit === 100 )
{
{
info( ` › ⚙️ Using default limit of \x1b[38;5;1m${ limit }\x1b[0m` )
if ( itemsTotal === 100 )
return deploymentRefs.concat( await listDeployments( client, { owner, repo, environment, ref, limit }, page + 1 ) )
Expand All @@ -56,8 +56,8 @@ async function listDeployments( client: Octokit, { owner, repo, environment, ref
*/

}
else if ( limit >= 100 )
{
else if ( limit >= 100 )
{
const pagesNeeded = Math.ceil( limit / 100 )

/*
Expand All @@ -66,11 +66,15 @@ async function listDeployments( client: Octokit, { owner, repo, environment, ref
*/

if ( itemsTotal < limit && page < pagesNeeded )
{
{
info( ` › ⚙️ Using custom limit of \x1b[38;5;1m${ limit }\x1b[0m › reading page \x1b[38;5;32mpage ${ page }/${ pagesNeeded }\x1b[0m` )
return deploymentRefs.concat( await listDeployments( client, { owner, repo, environment, ref, limit }, page + 1 ) )
}
}
else if ( limit !== 100 )
{
info( ` › ⚙️ Using custom limit of \x1b[38;5;1m${ limit }\x1b[0m › not using pagination` )
}

/*
Done getting items, return deployment list
Expand All @@ -87,7 +91,7 @@ async function listDeployments( client: Octokit, { owner, repo, environment, ref

async function setDeploymentInactive( client: Octokit, { owner, repo, deploymentId }: Deployment ): Promise < void >
{
info( ` › ✔️ ID \x1b[38;5;8m${ deploymentId }\x1b[0m inactive` )
info( ` › ✔️ ID \x1b[38;5;244m${ deploymentId }\x1b[0m inactive` )
await client.request( 'POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses',
{
owner,
Expand All @@ -103,7 +107,7 @@ async function setDeploymentInactive( client: Octokit, { owner, repo, deployment

async function deleteDeploymentById( client: Octokit, { owner, repo, deploymentId }: Deployment ): Promise < void >
{
info( ` › ✔️ ID \x1b[38;5;8m${ deploymentId }\x1b[0m deleted` )
info( ` › ✔️ ID \x1b[38;5;244m${ deploymentId }\x1b[0m deleted` )
await client.request( 'DELETE /repos/{owner}/{repo}/deployments/{deployment_id}',
{
owner,
Expand Down

0 comments on commit 3f2e5b0

Please sign in to comment.