Skip to content

Commit a8f47a6

Browse files
committed
feat: add option to disallow code generation from strings
1 parent 869d838 commit a8f47a6

2 files changed

Lines changed: 26 additions & 9 deletions

File tree

.github/workflows/plugins-ci.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ on:
3333
required: false
3434
default: '["20", "22"]'
3535
type: string
36+
check-disallow-code-generation-from-strings:
37+
description: 'Enables --disallow-code-generation-from-strings flag for Node.js'
38+
required: false
39+
default: false
40+
type: boolean
3641

3742
jobs:
3843
dependency-review:
@@ -110,12 +115,23 @@ jobs:
110115
matrix:
111116
node-version: ${{ fromJson(inputs.node-versions) }}
112117
os: [macos-latest, ubuntu-latest, windows-latest]
118+
disallow-code-generation-from-strings: ${{ inputs.check-disallow-code-generation-from-strings == true && ['true', 'false'] || ['false'] }}
113119
exclude:
114120
- os: macos-latest
115121
node-version: 14
116122
- os: macos-latest
117123
node-version: 16
118124
steps:
125+
- name: Set node flags
126+
id: node-flags
127+
shell: bash
128+
run: |
129+
if [ "${{ matrix.disallow-code-generation-from-strings }}" = "true" ]; then
130+
echo "flags=--disallow-code-generation-from-strings" >> $GITHUB_OUTPUT
131+
else
132+
echo "flags=" >> $GITHUB_OUTPUT
133+
fi
134+
119135
- name: Check out repo
120136
uses: actions/checkout@v4
121137
with:
@@ -130,7 +146,7 @@ jobs:
130146
run: npm i --ignore-scripts
131147

132148
- name: Run tests
133-
run: npm test
149+
run: NODE_OPTIONS="${{ steps.node-flags.outputs.flags }}" npm test
134150

135151
fastify-dependency-integration:
136152
name: Test Fastify Integration

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ jobs:
6262

6363
### Inputs
6464

65-
| Input Name | Required | Type | Default | Description |
66-
| ---------------------------------- | ---------- | ------- | --------- | ---------------------------------------------------------------------------------- |
67-
| `auto-merge-exclude` | false | string | `fastify` | Provide a semicolon separated list of packages that you do not want to be auto-merged. |
68-
| `fastify-dependency-integration` | false | boolean | `false` | Set to `true` to run fastify tests with the (proposed) changes. |
69-
| `license-check` | false | boolean | `false` | Set to `true` to check that a repository's production dependencies use permissive licenses: 0BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, or ISC. |
70-
| `license-check-allowed-additional` | false | string | | Provide a semicolon separated list of SPDX-license identifiers that you want to additionally allow. |
71-
| `lint` | false | boolean | `false` | Set to `true` to run the `lint` script in a repository's `package.json`. |
72-
| `node-versions` | false | string | `'["20", "22"]'` | Provide A JSON array that specifies the Node.js versions on which the job should run. |
65+
| Input Name | Required | Type | Default | Description |
66+
|-----------------------------------------------|----------|---------|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
67+
| `auto-merge-exclude` | false | string | `fastify` | Provide a semicolon separated list of packages that you do not want to be auto-merged. |
68+
| `fastify-dependency-integration` | false | boolean | `false` | Set to `true` to run fastify tests with the (proposed) changes. |
69+
| `license-check` | false | boolean | `false` | Set to `true` to check that a repository's production dependencies use permissive licenses: 0BSD, Apache-2.0, BSD-2-Clause, BSD-3-Clause, MIT, or ISC. |
70+
| `license-check-allowed-additional` | false | string | | Provide a semicolon separated list of SPDX-license identifiers that you want to additionally allow. |
71+
| `lint` | false | boolean | `false` | Set to `true` to run the `lint` script in a repository's `package.json`. |
72+
| `node-versions` | false | string | `'["20", "22"]'` | Provide A JSON array that specifies the Node.js versions on which the job should run. |
73+
| `check-disallow-code-generation-from-strings` | false | boolean | `false` | Enables --disallow-code-generation-from-strings flag for Node.js |
7374

7475
## Benchmark PR workflow
7576

0 commit comments

Comments
 (0)