Skip to content

Commit 3e7a7d7

Browse files
Copilothuangyiirene
andcommitted
Address code review feedback: add path triggers and improve security
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent c4b831e commit 3e7a7d7

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.github/workflows/labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: "Pull Request Labeler"
33
on:
44
pull_request:
55
types: [opened, synchronize, reopened]
6+
paths:
7+
- '**/*'
8+
- '.github/labeler.yml'
69

710
permissions:
811
contents: read

.github/workflows/validate-metadata.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
- '**/*.app.yml'
1111
- '**/*.page.yml'
1212
- '**/*.menu.yml'
13+
- 'scripts/validate-yaml.js'
1314
pull_request:
1415
branches: [ "main" ]
1516
paths:
@@ -19,6 +20,7 @@ on:
1920
- '**/*.app.yml'
2021
- '**/*.page.yml'
2122
- '**/*.menu.yml'
23+
- 'scripts/validate-yaml.js'
2224

2325
jobs:
2426
validate:

scripts/validate-yaml.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
* - *.app.yml
1010
* - *.page.yml
1111
* - *.menu.yml
12+
*
13+
* Dependencies:
14+
* - Requires 'js-yaml' from devDependencies
15+
* - Run 'pnpm install' before executing this script
1216
*/
1317

1418
const yaml = require('js-yaml');
@@ -73,7 +77,7 @@ async function validateFiles() {
7377
const results = await Promise.allSettled(
7478
files.map(async (file) => {
7579
const content = await fs.promises.readFile(file, 'utf8');
76-
yaml.load(content);
80+
yaml.load(content, { schema: yaml.DEFAULT_SAFE_SCHEMA });
7781
return file;
7882
})
7983
);

0 commit comments

Comments
 (0)