diff --git a/lib/setup-terraform.js b/lib/setup-terraform.js index f3269a6..61f61aa 100644 --- a/lib/setup-terraform.js +++ b/lib/setup-terraform.js @@ -87,7 +87,7 @@ async function installWrapper (pathToCLI) { wrapperContent[0] = `#!${process.argv[0]}`; core.debug(`Writing updated wrapper to ${target}.`); - await fs.writeFile(target, wrapperContent.join('\n')); + await fs.writeFile(target, wrapperContent.join('\n'), { mode: 0o755 }); } catch (e) { core.error(`Unable to copy ${source} to ${target}.`); throw e; diff --git a/test/setup-terraform.test.js b/test/setup-terraform.test.js index 768d0ce..7a8eef0 100644 --- a/test/setup-terraform.test.js +++ b/test/setup-terraform.test.js @@ -602,7 +602,7 @@ describe('Setup Terraform', () => { expect(ioMv).toHaveBeenCalledWith(`file${path.sep}terraform`, `file${path.sep}terraform-bin`); expect(fsReadFile).toHaveBeenCalledWith(wrapperPath, 'utf8'); - expect(fsWriteFile).toHaveBeenCalledWith(`file${path.sep}terraform`, expect.any(String)); + expect(fsWriteFile).toHaveBeenCalledWith(`file${path.sep}terraform`, expect.any(String), { mode: 0o755 }); }); test('installs wrapper on windows', async () => { @@ -660,6 +660,6 @@ describe('Setup Terraform', () => { expect(ioMv).toHaveBeenCalledWith(`file${path.sep}terraform.exe`, `file${path.sep}terraform-bin.exe`); expect(fsReadFile).toHaveBeenCalledWith(wrapperPath, 'utf8'); - expect(fsWriteFile).toHaveBeenCalledWith(`file${path.sep}terraform`, expect.any(String)); + expect(fsWriteFile).toHaveBeenCalledWith(`file${path.sep}terraform`, expect.any(String), { mode: 0o755 }); }); });