豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit a632a16

Browse files
committed
fix(github-actions): set remote exec script as executable and prevent regression
Note, I considered implementing another rule like `generated_file_test` that supports ensuring file permissions- but it's not worth the effort and a simple test can be implemented to verify permissions.
1 parent 2f48b93 commit a632a16

File tree

5 files changed

+35
-0
lines changed

5 files changed

+35
-0
lines changed

circleci-orb/pack-orb-script.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ ${content}
1818
NGEOF
1919
`;
2020
await fs.promises.writeFile(outputExecpath, output, 'utf8');
21+
await fs.promises.chmod(outputExecpath, 0o777);
2122
}
2223

2324
try {

github-actions/setup-bazel-remote-exec/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
22

33
package(default_visibility = ["//github-actions/slash-commands:__subpackages__"])
44

5+
exports_files(["setup_remote_exec.sh"])
6+
57
generated_file_test(
68
name = "setup_remote_exec_script",
79
src = "setup_remote_exec.sh",

github-actions/setup-bazel-remote-exec/setup_remote_exec.sh

100644100755
File mode changed.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_test")
2+
3+
nodejs_test(
4+
name = "test_file_permission_setup_script",
5+
args = [
6+
"$(execpath //github-actions/setup-bazel-remote-exec:setup_remote_exec.sh)",
7+
],
8+
data = [
9+
"check-file-permission.mjs",
10+
"//github-actions/setup-bazel-remote-exec:setup_remote_exec.sh",
11+
],
12+
entry_point = ":check-file-permission.mjs",
13+
)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import fs from 'fs';
10+
11+
const scriptAbsPath = process.argv[2];
12+
13+
try {
14+
await fs.promises.access(scriptAbsPath, fs.constants.X_OK);
15+
} catch (e) {
16+
console.error(`Script at: ${scriptAbsPath} is not executable.`);
17+
console.error(e);
18+
process.exitCode = 1;
19+
}

0 commit comments

Comments
 (0)