Skip to content

Commit feda3d9

Browse files
committed
Correctly make executable when not on windows
1 parent 22dbd74 commit feda3d9

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-run-script",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "Run a script on multiple repositories, cloning them if needed.",
55
"main": "dist/index.js",
66
"type": "commonjs",

src/templates/cp.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { writeFile } from "fs/promises";
1+
import { chmod, writeFile } from "fs/promises";
22
import { GenerateTemplateCliFlags, Template } from "../types";
33
import { getOutputPath } from "../utils";
44

@@ -34,8 +34,7 @@ export default class CpTemplate implements Template {
3434
commit_message: string,
3535
flags: GenerateTemplateCliFlags
3636
) => {
37-
const templateString = `
38-
#!/bin/bash
37+
const templateString = `#!/bin/bash
3938
$FILE="${source_file}"
4039
$RELATIVE_DEST="${dest_path}"
4140
$COMMIT_MESSAGE="${commit_message}"
@@ -47,6 +46,9 @@ git push
4746
`;
4847
const outputPath = await getOutputPath(this, flags);
4948
await writeFile(outputPath, templateString);
49+
if (process.platform !== "win32") {
50+
await chmod(outputPath, "755");
51+
}
5052
console.log(`Output log written to: ${outputPath}`);
5153
};
5254
}

0 commit comments

Comments
 (0)