Skip to content

Commit 23f88e0

Browse files
committed
Fix defaults
1 parent b6346fc commit 23f88e0

File tree

10 files changed

+68
-107
lines changed

10 files changed

+68
-107
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# For most projects, this workflow file will not need changing; you simply need
22
# to commit it to your repository.
33
#
4-
# You may wish to alter this file to override the set of languages analyzed,
4+
# You may wish to alter this file to override the set of languages analysed,
55
# or to provide custom queries or build logic.
66
#
77
# ******** NOTE ********

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@
2727
"files.trimTrailingWhitespace": true,
2828
"cSpell.language": "en-GB",
2929
"cSpell.words": [
30+
"Autobuild",
3031
"badsyntax",
3132
"Behavior",
33+
"codeql",
3234
"color",
3335
"etag",
3436
"globber",

action.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ inputs:
3232
ETag
3333
ContentType
3434
CacheControl
35-
LastModified
36-
ContentLength
3735
description: 'A newline-separated list of criteria to define the sync strategy. Criteria include: ETag, ContentType, CacheControl, LastModified, ContentLength'
3836
strip-extension-glob:
3937
require: false

dist/index.js

Lines changed: 25 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__tests__/s3.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import fs from 'node:fs';
22
import path from 'node:path';
33
import { describe, it, expect } from '@jest/globals';
4+
import type { HeadObjectCommandOutput } from '@aws-sdk/client-s3';
45
import {
56
getObjectKeyFromFilePath,
67
getFilesFromSrcDir,
78
shouldUploadFile,
8-
} from '../s3';
9-
import { HeadObjectCommandOutput } from '@aws-sdk/client-s3';
9+
generateSyncCriteria,
10+
} from '../s3.js';
1011

1112
describe('getObjectKeyFromFilePath', () => {
1213
it('should generate the key', () => {
@@ -53,7 +54,7 @@ describe('shouldUploadFile', () => {
5354
fs.statSync(absoluteFilePath);
5455

5556
it('should upload if no metadata is specified', async () => {
56-
const criteria = 'ETag\nCache-Control';
57+
const criteria = generateSyncCriteria('ETag\nCache-Control');
5758
const metadata = undefined;
5859
const shouldUpload = await shouldUploadFile(
5960
absoluteFilePath,
@@ -71,7 +72,7 @@ describe('shouldUploadFile', () => {
7172
});
7273

7374
it('should upload if no criteria is specified', async () => {
74-
const criteria = '';
75+
const criteria = generateSyncCriteria('');
7576
const metadata = { $metadata: {} };
7677

7778
const shouldUpload = await shouldUploadFile(
@@ -90,13 +91,13 @@ describe('shouldUploadFile', () => {
9091
});
9192

9293
describe('matching criteria', () => {
93-
const criteria = `
94+
const criteria = generateSyncCriteria(`
9495
ETag
9596
ContentType
9697
CacheControl
9798
LastModified
9899
ContentLength
99-
`;
100+
`);
100101

101102
const metadata: HeadObjectCommandOutput = {
102103
$metadata: {},

src/defaults.ts

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/inputs.ts

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
11
import { getInput } from '@actions/core';
2-
import {
3-
defaultConcurrency,
4-
defaultLargeFileSizeInMb,
5-
defaultMultipartUploadPartsInBytes,
6-
defaultSyncStrategy,
7-
} from './defaults.js';
82

93
export function getInputs() {
104
const bucket = getInput('bucket', {
@@ -52,44 +46,31 @@ export function getInputs() {
5246
trimWhitespace: true,
5347
});
5448

55-
const _multipartFileSizeMb = parseInt(
49+
const multipartFileSizeMb = Number(
5650
getInput('multipart-file-size-mb', {
5751
required: false,
5852
trimWhitespace: true,
59-
}),
60-
10
53+
})
6154
);
6255

63-
const multipartFileSizeMb = isNaN(_multipartFileSizeMb)
64-
? defaultLargeFileSizeInMb
65-
: _multipartFileSizeMb;
66-
67-
const _multipartChunkBytes = parseInt(
56+
const multipartChunkBytes = Number(
6857
getInput('multipart-chunk-bytes', {
6958
required: false,
7059
trimWhitespace: true,
71-
}),
72-
10
60+
})
7361
);
7462

75-
const multipartChunkBytes = isNaN(_multipartChunkBytes)
76-
? defaultMultipartUploadPartsInBytes
77-
: _multipartFileSizeMb;
78-
79-
const _concurrency = parseInt(
63+
const concurrency = Number(
8064
getInput('concurrency', {
8165
required: false,
8266
trimWhitespace: true,
8367
})
8468
);
8569

86-
const concurrency = isNaN(_concurrency) ? defaultConcurrency : _concurrency;
87-
88-
const syncStrategy =
89-
getInput('sync-strategy', {
90-
required: false,
91-
trimWhitespace: true,
92-
}) || defaultSyncStrategy;
70+
const syncStrategy = getInput('sync-strategy', {
71+
required: false,
72+
trimWhitespace: true,
73+
});
9374

9475
return {
9576
bucket,

0 commit comments

Comments
 (0)