Skip to content

Commit 08df0e7

Browse files
committed
feat: use GitHub environments
1 parent 2326bdc commit 08df0e7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.github/workflows/action-run-semgrep.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ on:
3636
- p/python (public library)
3737
- ./rules/my-rule.yaml (single YAML file)
3838
- ./my-rules/ (directory of N YAML files)
39-
39+
4040
By default the rules will be added on top of this workflow's default rules
4141
(see the input `use_default_config` and the environment variable
4242
`DEFAULT_CONFIG` for more information).
@@ -119,7 +119,7 @@ jobs:
119119
EXCLUDE_RULES: ${{ inputs.exclude_rules }}
120120
run: |
121121
set -u -o pipefail
122-
122+
123123
cmd_args=(
124124
# Do not check for version update as we are inside a CI.
125125
"--disable-version-check"
@@ -131,32 +131,32 @@ jobs:
131131
# the users to be explicit.
132132
"--no-git-ignore"
133133
)
134-
134+
135135
# Add extra logging if the runner was run with debug logging.
136136
test -z "${RUNNER_DEBUG+x}" || cmd_args+=( "--verbose" )
137-
137+
138138
if [ "$USE_DEFAULT_CONFIG" == true ]; then
139139
CONFIG_PATHS="$DEFAULT_CONFIG $CONFIG_PATHS"
140140
fi
141-
141+
142142
if [ "$USE_DEFAULT_EXCLUDE_RULES" == true ]; then
143143
EXCLUDE_RULES="$DEFAULT_EXCLUDE_RULE_IDS $EXCLUDE_RULES"
144144
fi
145-
145+
146146
# Gather the config input whitespace-separate value
147147
# into a list of `--config=<value>` arguments.
148148
read -d '' -r -a configs < <(echo "$CONFIG_PATHS") || true
149149
for cfg in "${configs[@]}"; do
150150
cmd_args+=( "--config=$cfg" )
151151
done
152-
152+
153153
# Gather the excluded rules ID into a list
154154
# of `--exclude-rule=<value>` arguments.
155155
read -d '' -r -a exclude_rules < <(echo "$EXCLUDE_RULES") || true
156156
for excluded_rule_id in "${exclude_rules[@]}"; do
157157
cmd_args+=( "--exclude-rule=$excluded_rule_id" )
158158
done
159-
159+
160160
semgrep ci "${cmd_args[@]}"
161161
162162
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # 4.3.0
@@ -181,6 +181,8 @@ jobs:
181181
# Note: distroless flavor doesn't work on GHA.
182182
image: ghcr.io/nyankiyoshi/less-advanced-security@sha256:689f73bed448ce40ca4ed01f6585f22665c0c302ed0e882d1fc78016c12f2880 # 0.5.0
183183

184+
environment: sarif-exporter
185+
184186
steps:
185187
- name: Download SARIF Results
186188
uses: actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935 # v4.1.1

0 commit comments

Comments
 (0)