Skip to content

Commit 3c4be1f

Browse files
Planeshiftersaurabhraghuvanshii
authored andcommitted
build: skip subsequent steps instead of failing workflow
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed --- --- type: pre_push_report description: Results of running various checks prior to pushing changes. report: - task: run_javascript_examples status: na - task: run_c_examples status: na - task: run_cpp_examples status: na - task: run_javascript_readme_examples status: na - task: run_c_benchmarks status: na - task: run_cpp_benchmarks status: na - task: run_fortran_benchmarks status: na - task: run_javascript_benchmarks status: na - task: run_julia_benchmarks status: na - task: run_python_benchmarks status: na - task: run_r_benchmarks status: na - task: run_javascript_tests status: na ---
1 parent d6c7a6d commit 3c4be1f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

.github/workflows/run_tests_coverage.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,19 +187,24 @@ jobs:
187187

188188
# Exit early if non-package directories are changed:
189189
- name: 'Exit early if non-package directories are changed'
190+
id: check-changed
190191
if: github.event_name != 'workflow_dispatch'
191192
run: |
192193
directories="${{ steps.changed-directories.outputs.directories }}"
194+
skip="false"
193195
for directory in $directories; do
194196
if [[ "$directory" != "lib/node_modules/@stdlib"* ]]; then
195-
echo "Error: changed directory '$directory' is not in 'lib/node_modules/@stdlib'."
196-
exit 1
197+
echo "Warning: changed directory '$directory' is not in 'lib/node_modules/@stdlib'. Skipping the rest of the workflow."
198+
skip="true"
199+
break
197200
fi
198201
done
202+
echo "skip=${skip}" >> $GITHUB_OUTPUT
199203
200204
# Run JavaScript tests:
201205
- name: 'Run JavaScript tests'
202206
id: extract-coverage
207+
if: steps.check-changed.outputs.skip == 'false'
203208
env:
204209
GITHUB_REPO: ${{ github.repository }}
205210
GITHUB_REF: ${{ github.ref }}
@@ -224,6 +229,7 @@ jobs:
224229
# Create final coverage report:
225230
- name: 'Create final coverage report'
226231
id: create-report
232+
if: steps.check-changed.outputs.skip == 'false'
227233
run: |
228234
table="${{ steps.extract-coverage.outputs.table }}"
229235
if [ -z "$table" ]; then
@@ -244,7 +250,7 @@ jobs:
244250
245251
# Post report as comment to PR:
246252
- name: 'Post report as comment to PR'
247-
if: github.event_name == 'pull_request_target'
253+
if: github.event_name == 'pull_request_target' && steps.check-changed.outputs.skip == 'false'
248254
# Pin action to full length commit SHA
249255
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
250256
with:
@@ -275,7 +281,7 @@ jobs:
275281
276282
# Post report as comment to commit:
277283
- name: 'Post report as comment to commit'
278-
if: github.event_name == 'push'
284+
if: github.event_name == 'push' && steps.check-changed.outputs.skip == 'false'
279285
# Pin action to full length commit SHA
280286
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
281287
with:
@@ -290,6 +296,7 @@ jobs:
290296
291297
# Checkout coverage repository:
292298
- name: 'Checkout coverage repository'
299+
if: steps.check-changed.outputs.skip == 'false'
293300
# Pin action to full length commit SHA
294301
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
295302
with:
@@ -313,6 +320,7 @@ jobs:
313320

314321
# Checkout coverage repository branch:
315322
- name: 'Checkout coverage repository branch'
323+
if: steps.check-changed.outputs.skip == 'false'
316324
run: |
317325
cd ./www-test-code-coverage
318326
@@ -329,6 +337,7 @@ jobs:
329337
330338
# Copy artifacts to the repository:
331339
- name: 'Copy artifacts to the repository'
340+
if: steps.check-changed.outputs.skip == 'false'
332341
run: |
333342
if [ -d "./artifacts" ]; then
334343
cp -R ./artifacts/* ./www-test-code-coverage
@@ -350,6 +359,7 @@ jobs:
350359
351360
# Import GPG key to sign commits:
352361
- name: 'Import GPG key to sign commits'
362+
if: steps.check-changed.outputs.skip == 'false'
353363
# Pin action to full length commit SHA
354364
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5 # v6.2.0
355365
with:
@@ -360,6 +370,7 @@ jobs:
360370

361371
# Commit and push changes:
362372
- name: 'Commit and push changes'
373+
if: steps.check-changed.outputs.skip == 'false'
363374
env:
364375
REPO_GITHUB_TOKEN: ${{ secrets.STDLIB_BOT_PAT_REPO_WRITE }}
365376
USER_NAME: stdlib-bot

0 commit comments

Comments
 (0)