Skip to content

Commit 0e4ab77

Browse files
committed
chore: format to 4space indent
Signed-off-by: Nico Braun <[email protected]>
1 parent 7fbd47d commit 0e4ab77

File tree

7 files changed

+228
-219
lines changed

7 files changed

+228
-219
lines changed

.editorconfig

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@ root = true
33
[*]
44
charset = utf-8
55
end_of_line = lf
6-
indent_size = 2
76
indent_style = space
87
insert_final_newline = true
9-
tab_width = 4
108
trim_trailing_whitespace = true
9+
indent_size = 4
10+
tab_width = 4
1111

1212
[*.md]
1313
trim_trailing_whitespace = false
14+
15+
[*.json,yaml,yml]
16+
indent_size = 2

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Cloudflare R2.
5050

5151
```yml
5252
- name: Set up S3cmd cli tool
53-
uses: s3-actions/s3cmd@v1.10.1
53+
uses: s3-actions/s3cmd@v2.0.0
5454
with:
5555
provider: aws # default is linode
5656
region: 'eu-central-1'

action.test.js

+20-17
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,28 @@ const { RunOptions, RunTarget } = require("github-action-ts-run-api");
55
const { tests } = require("./src/providers");
66

77
(async () => {
8-
for (const [name, { giveInputs, wantLines }] of Object.entries(tests)) {
9-
console.log(`\n---\nTesting provider: ${name}`);
8+
for (const [name, { giveInputs, wantLines }] of Object.entries(tests)) {
9+
console.log(`\n---\nTesting provider: ${name}`);
1010

11-
const target = RunTarget.mainJs("action.yml");
12-
const options = RunOptions.create()
13-
.setFakeFsOptions({ rmFakedTempDirAfterRun: false })
14-
.setInputs(giveInputs);
11+
const target = RunTarget.mainJs("action.yml");
12+
const options = RunOptions.create()
13+
.setFakeFsOptions({ rmFakedTempDirAfterRun: false })
14+
.setInputs(giveInputs);
1515

16-
const res = await target.run(options);
17-
try {
18-
assert.strictEqual(res.exitCode, 0);
16+
const res = await target.run(options);
17+
try {
18+
assert.strictEqual(res.exitCode, 0);
1919

20-
const b = readFileSync(join(res.tempDirPath, "s3cmd.conf"));
21-
const data = b.toString();
22-
for (const line of wantLines) {
23-
assert.ok(data.includes(line), `${name}: missing line: ${line}`);
24-
}
25-
} finally {
26-
res.cleanUpFakedDirs();
20+
const b = readFileSync(join(res.tempDirPath, "s3cmd.conf"));
21+
const data = b.toString();
22+
for (const line of wantLines) {
23+
assert.ok(
24+
data.includes(line),
25+
`${name}: missing line: ${line}`,
26+
);
27+
}
28+
} finally {
29+
res.cleanUpFakedDirs();
30+
}
2731
}
28-
}
2932
})();

pre-commit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ set -e
44
echo "building action:"
55
exec 2>&1
66
npm run build
7-
return 0
7+
return 0

src/config.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ const { createWriteStream } = require("node:fs");
55
const defaults = require("./defaults.json");
66

77
function build(provider) {
8-
const opts = { ...defaults, ...provider };
9-
return Object.entries(opts).map(([k, v]) => `${k} = ${v}`);
8+
const opts = { ...defaults, ...provider };
9+
return Object.entries(opts).map(([k, v]) => `${k} = ${v}`);
1010
}
1111

1212
function write(path, lines) {
13-
const writer = createWriteStream(path);
14-
for (const line of lines) {
15-
writer.write(line + "\r\n");
16-
}
13+
const writer = createWriteStream(path);
14+
for (const line of lines) {
15+
writer.write(line + "\r\n");
16+
}
1717
}
1818

1919
function configure(settings, access_key, secret_key) {
20-
const path = process.env.S3CMD_CONFIG || join(homedir(), ".s3cfg");
21-
return write(path, build({ ...settings, access_key, secret_key }));
20+
const path = process.env.S3CMD_CONFIG || join(homedir(), ".s3cfg");
21+
return write(path, build({ ...settings, access_key, secret_key }));
2222
}
2323

2424
module.exports = {
25-
configure,
26-
build,
27-
write,
25+
configure,
26+
build,
27+
write,
2828
};

src/index.js

+34-32
Original file line numberDiff line numberDiff line change
@@ -6,48 +6,50 @@ const { configure } = require("./config");
66
const providers = require("./providers");
77

88
try {
9-
const s = execSync("s3cmd --version").toString().trim();
10-
core.notice(`s3cmd already installed: ${s}`);
9+
const s = execSync("s3cmd --version").toString().trim();
10+
core.notice(`s3cmd already installed: ${s}`);
1111
} catch {
12-
const s3cmdVersion = core.getInput("s3cmd_version") || "2.4.0";
13-
14-
const cmd = [
15-
"pip3",
16-
"install",
17-
`s3cmd==${s3cmdVersion}`,
18-
"--no-cache",
19-
"--break-system-packages",
20-
];
21-
22-
// on new versions of linux, pip wont install system wide packages
23-
// without using the --break-system-packages flag. however, on older
24-
// systems, this flag is not known to pip and will cause an error.
25-
try {
26-
core.notice("attempting to install s3cmd");
27-
core.debug(execSync(cmd.join(" ")).toString());
28-
} catch {
29-
core.debug("pip3 install failed, trying without --break-system-packages");
30-
cmd.pop();
31-
core.debug(execSync(cmd.join(" ")).toString());
32-
}
12+
const s3cmdVersion = core.getInput("s3cmd_version") || "2.4.0";
13+
14+
const cmd = [
15+
"pip3",
16+
"install",
17+
`s3cmd==${s3cmdVersion}`,
18+
"--no-cache",
19+
"--break-system-packages",
20+
];
21+
22+
// on new versions of linux, pip wont install system wide packages
23+
// without using the --break-system-packages flag. however, on older
24+
// systems, this flag is not known to pip and will cause an error.
25+
try {
26+
core.notice("attempting to install s3cmd");
27+
core.debug(execSync(cmd.join(" ")).toString());
28+
} catch {
29+
core.debug(
30+
"pip3 install failed, trying without --break-system-packages",
31+
);
32+
cmd.pop();
33+
core.debug(execSync(cmd.join(" ")).toString());
34+
}
3335
}
3436

3537
// set the config file location via env var to the github temp dir.
3638
// the variable needs to persist for subsequent commands, so we set it as a
3739
// github action variable as well.
3840
if (process.env.RUNNER_TEMP) {
39-
process.env.S3CMD_CONFIG = `${process.env.RUNNER_TEMP}/s3cmd.conf`;
40-
core.exportVariable("S3CMD_CONFIG", process.env.S3CMD_CONFIG);
41-
core.debug(`S3CMD_CONFIG=${process.env.S3CMD_CONFIG}`);
41+
process.env.S3CMD_CONFIG = `${process.env.RUNNER_TEMP}/s3cmd.conf`;
42+
core.exportVariable("S3CMD_CONFIG", process.env.S3CMD_CONFIG);
43+
core.debug(`S3CMD_CONFIG=${process.env.S3CMD_CONFIG}`);
4244
}
4345

4446
configure(
45-
providers[core.getInput("provider")]({
46-
region: core.getInput("region"),
47-
account_id: core.getInput("account_id"),
48-
}),
49-
core.getInput("access_key"),
50-
core.getInput("secret_key"),
47+
providers[core.getInput("provider")]({
48+
region: core.getInput("region"),
49+
account_id: core.getInput("account_id"),
50+
}),
51+
core.getInput("access_key"),
52+
core.getInput("secret_key"),
5153
);
5254

5355
return 0;

0 commit comments

Comments
 (0)